[comp.sys.mac.hypercard] arrays/subscripts allowed?

jvance@desire.wright.edu (03/16/91)

Does hypercard admit anything like arrays, or variables with one or 
more subscripts, as in x(5), y(23,17), etc?  I would dearly love to 
be able to write a little script on the order of

repeat with i = 1 to 100
   repeat with j = 1 to 4
       put word j of line i of card field whatever into x(i,j)
   end repeat
end repeat

with the understanding that hypercard would allow me to use the 
expressions   x(1,1), x(1,2), x(1,3), x(1,4), x(2,1), ... , x(100,4)
as variable names.

If it matters, I do not have hypercard 2.

If you can help me with this one, please reply to jvance@wsu (bitnet)
or jvance@desire.wright.edu (internet).  _Thanks_!

Jim Vance 

mg2x+@andrew.cmu.edu (Michael Andrew Gelman) (03/18/91)

> Excerpts from netnews.comp.sys.mac.hypercard: 16-Mar-91
> arrays/subscripts allowed? jvance@desire.wright.edu (658)

> Does hypercard admit anything like arrays, or variables with one or 

> more subscripts, as in x(5), y(23,17), etc?

Not as such, but you can fake it with chunking.  So that:
	Array(4) --> word 4 of Array
Or
	Array(2,5) --> word 5 of line 2 of Array

(If there is anything cleaner, I don't know about it.  I'd be interested
to hear.)

Yours Chunkily,
Michael A. Gelman (mg2x@andrew.cmu.edu)
Student Programmer/Consultant -- Faculty Software Development Lab
Carnegie Mellon University,  Pittsburgh, PA

msriram@giza.cis.ohio-state.edu (M G SriRam) (03/18/91)

another way to fake arrays is to use the do command. eg, suppose
you want to initialize 10 variables of the form X1.. X10 to 0. you
could do the folowing:

repeat with n = 1 to 10
 do "put 0 into X"&n
end repeat

the X(*) or X[*] sytnax for arrays cannot be achieved because
the only symbols allowed in variable names are letters, digits
and the underscore.

hope this is useful.
sriram