use repeat for each line L ... and collect the modified lines in a separate variable, replace the original variable after the loop

repeat fer each line L in tData
   put ... & CR after temp
end repeat
put temp into tData

should be very quick.

-- Alex.
btw - not needed in this case, but you could use split/combine in it's "single separator" form
split tData by CR
repeat with i = 1 to the number of lines in the keys of tData
   put .... into tData[i]
end repeat
combine tData by CR



On 10/03/2011 18:51, FlexibleLearning wrote:
Problem:
I have a long list of several thousand lines.
Each line contains two comma-separated numbers.
I want to divide the first item of each line by one divisor, and divide the
second item of each line by a different divisor.
The list order must stay the same.

Example:
Using 2 and 5 as divisors...
   10,10
   12,15
   8,12
would become
   5,2
   6,3
   4,2.4

Options:
Using "repeat with n=1 to num of lines" takes far too long.
Using "repeat for each line L" either attempts to modify read-only data, or
is only 25% faster using a dumping variable.
Using split/combine will mess up the ordering (numeric array keys are not
sorted numerically with combine).

Any other ideas?

Hugh Senior
FLCo





_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to