array questions..

Jacques HAUSSER Jacques.Hausser at
Wed Oct 16 02:20:01 EDT 2002

>   I'd imagine that the arrays are actually hash
>tables, where the is no definite decernible order to how the keys come
>out. (I'm assumming that the 'keys' function just goes through memory in
>order' wehreas the creating of the key uses a complicated hash value of
>that key and won't neccessarily come up in order (a typical hash function
>would be:
>put 0 into val
>repeat for each char k in string
>	add chrnum(k)*9 to val
>end repeat
>put val mod 51 into val
>-- the modulus at the end should be a prime for optimal table
>non-clustering, and the multiplier on the alphanumeric factor might be
>important too to be a prime
>   Of course, this kind of hash table is almost a neccesity if your're
>dealing with variables like myArray("this") myArray("that") myArray("cat")
>and such, but with straight numeric addresses, I'd think a standard C-type
>array structure might be more efficient - of course, implmenting that as a
>hash table as well lets you add new keys in at will (say you have keys
>1,2,3,5,and 6, then wanted to add the 4 key in later.  No imagine doing
>this in a two-dimensional array with a "hole" or two in it.)

Thank you, Jim, I didn't think of that... but even so, I can't figure 
why my array cannot be transposed by the transpose function!

Prof. Jacques Hausser
Institut d'Ecologie
Laboratoire de Zoologie et d'Ecologie animale
Bâtiment de biologie
CH - 1015 Lausanne
tel: + 41 21 692 41 62
fax: + 41 21 692 41 65
eMail: Jacques.Hausser at

More information about the use-livecode mailing list