on 11/08/2001 5:10 PM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: "Geoff Canyon" <[EMAIL PROTECTED]>, on Thu, 8 Nov 2001 15:10:00 helpfully responded to Raymond's request
> At 3:52 PM -0500 11/8/01, Raymond E. Griffith wrote: >> I am trying to work with the new array notation. Here is a >> simple script. >> >> on mouseUp >> put fld "A" into A >> split A by return >> put A + 1 into B >> combine B using return >> put B into fld "B" >> end mouseUp >> >> In fld "A" I have the numbers 1 through 20. Upon combining >> B, the results are returned in a seemingly random order. The >> results are >> >> 2.000000 >> 11.000000 (snip) >> I have some questions. First, how can I get the results in >> the proper order? Using the sort command has not worked. > > The ordering isn't random -- it's a standard text sort. You get 2,11,12... as > your results because if the keys of an array are the numbers 1 through 21, > then the keys sorted by text are: 1,10,11,12,13,14,15,16,17,18,19,20... > > So the math is working, and the order (by text) is maintained. > > To get the results back in numeric order, after the combine try: > > sort lines of B numeric > This won't work. Suppose that that array A is [[ -4 -3 -2 -1 0 1 2 3 ]] and that the operation is "put A*A into B" The result should be [[ 16 9 4 1 0 1 4 9 ]] Also, consider two arrays with numeric nonordered data which are added together. Sort numeric on the "combined" array would defeat the proper order. What we need is a way to get the array to not mix up its keys upon "split", or else to return the proper order upon "combine". But thanks! Any other suggestions? Raymond > I don't know how to change the number format you're getting back, other than > doing a repeat for each loop, which I understand defeats the purpose. > > regards, > > Geoff Archives: http://www.mail-archive.com/[email protected]/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to <[EMAIL PROTECTED]>, not this list.
