Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: HT & Data structures Message-ID: <39336@apple.Apple.COM> Date: 9 Mar 90 05:42:54 GMT References: <1779@loria.crin.fr> Organization: Apple Computer Inc, Cupertino, CA Lines: 31 In article <1779@loria.crin.fr> tenachi@loria.crin.fr writes: > [...] I have a question concerning data structures >in HyperTalk. I wondred if we have the ability to handle non simple data types >such as arraies, records, pointers.. like in classic languages. Until now I >haven't found something dealing with this in the documentation. Variables in HyperTalk are untyped, so there is not e.g. an array type as such. However, you can do most (if not all) of the work of records and (simple) arrays by using chunk expressions (word, line, item, character) within a variable to structure your data. For instance, suppose you wish to create a record consisting of the name, ID, and number of a card. This can be done by storing the name in line 1 of your variable, the ID in line 2, and the number in line 3. The values are accessed directly (e.g. "get line 3 of myVariable"). Arrays can be created in similar fashion. Suppose you want a two-dimensional array: one simple way to accomplish this is to use item number as one index and line number as the other. To access the [4,7]th item of the array, you would use the chunk expression "item 4 of line 7 of myArray". The main limitation I find is that the data can't contain the characters used as delimiters; if you're using items as array elements, your data can't contain commas, for instance. -- ====== jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.UUCP | compilation copyright without my permission. ___________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST