On Friday, June 20, 2003, at 11:47 AM, Dar Scott wrote:
On Friday, June 20, 2003, at 12:00 PM, Mark Brownell wrote:
Does anyone have any testing examples regarding arrays and array-management in a stack that uses numbers? How about suggestions for array optimization techniques?
Though contents of array elements can be the internal form of numbers (8-byte float), the keys are strings. If you use numbers as keys, they are converted to strings using the numberFormat local property. However, keys and contents-as-strings do not have constraints on the characters, they can be any byte sequence.
Dar Scott
Hi Dar,
So: in example: -785314906, - 805139163, -803545161, -1193168915,
I would need to use variable references to my array of numbers.
Example:
put "-785314906, -1730169428, 805139163, -803545161, -1193168915," into stringX
set itemDelimiter to ","
repeat with i = 1 to 5
put item i of stringX into zap
-- put value(zap) into myList[ i ]-- test one
put zap into myList[ i ] -- test two & three
end repeat
-- put myList[1] -- test 1 & 2
put myList[1] + 1 -- test three
end mouseUp
test one -- yields -785314906
test two -- yields -785314906 ... I expected a string "-785314906"
test three -- yields -785314905
So in test three, even though the itemDelimiter extracted
numerical values from a quoted string, the array got populated
with values that could have math change the outcome.
This is very interesting. I'm not sure if this intuition
turns out as just RunRev luck or it is some practical solution
for use of the item function in strings.
In any case, the optimization is that I won't need to use value()
in my block-cypher loops. :-)
Mark
