arrays

Jacques HAUSSER Jacques.Hausser at ie-zea.unil.ch
Thu Oct 17 05:11:01 EDT 2002


At 3:00 -0400 17.10.2002, use-revolution-request at lists.runrev.com wrote:
>  >Transpose: I tried "put transpose(Gdonnees) into Gdonnees", and 
>the answer was
>>"can't transpose this array" (the same if the transpose was put into
>>another variable).
>>It was a 10 x 28 global array (with numeric keys) which was perfectly
>>transposable with a hand-made transposition function, but I'm sure
>>the built-in function would increase the speed - if it agrees to
>>work. Which reason(s) can prevent transpose to work ?
>
>Not sure. Are the keys in your array successive numbers (that is 1,2,3...
>with no gaps)? Perhaps you could post the code that generates the array.
>
>
>>another question: if one has a global array, say GArray, and wants to
>>clean it, are the results of "delete GArray" and "put empty into
>>GArray" exactly equivalents?
>
>No. Using the "put empty into" command, the global variable still exists
>but has nothing in it (therefore the keys function returns empty because
>the variable has no elements). But it still appears in the globalNames and
>variableNames functions.


Thanks, Jane

The array is filled from a datasheet (the detailed scripts are a bit 
long to be sent) and the code is something like that (filledField has 
a name like "FLC 2 5"):

put word 2 of the short name of filledField into i
put word 3 of the short name of filledField into j
put filledField into GDonnees[i,j]
--(do plenty of other things using i and j, but without using 
GDonnees any more)

... oh,oh! Light on! in my "transmat" routine and its nested repeat 
loops, the possible missing elements are automatically created. I 
guess transpose expect them to exist. It should be the case if the 
function swaps the contents, but not if it swaps the keys.
I read the transcript dictionnary again, it says "after swaping the 
order of keys", and in the comments, "the corresponding element in 
transpose(array) has its two parts switched one for the other", but 
farther away "the value (...) is moved (...)". A bit contradictory!

Note than a "really key swapping" transpose would be of more general 
use, allowing transposition of alphabetic keys as well. Meanwhile, 
I'll stick to my "transmat" routine to allow my students to transpose 
"semi-empty" matrices...

Still many thanks - Jacques
-- 
==========================================
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 ie-zea.unil.ch
==========================================



More information about the use-livecode mailing list