Making the move...

Sarah Reichelt sarah.reichelt at gmail.com
Tue Mar 21 19:55:21 EST 2006


On 3/21/06, Geoff Canyon <gcanyon at inspiredlogic.com> wrote:
> Do you have an example? I agree that if you end up passing in a
> handful of arguments by reference, you haven't accomplished much by
> breaking out the routine. The question is if there isn't a better way
> to slice the routine, where that wouldn't be necessary.
>

OK, I have a better example. Say I have a data set and I need to loop
through it and extract three different pieces of information e.g. a
list of the 4th column in each line, a list of lines that match a
certain set of criteria, and a cumulative total obtained by adding a
certain column in each line.

Each of these could be done in a separate function, but that would
mean looping through the data set three times. With a large data set,
it is significantly faster to loop once, filling all three new
variables in the single loop. If I separate this off into a separate
function, then I need a way of passing multiple results back.

The alternatives that I see are to use script local variables or to
pass an empty parameter by reference and have the function fill it.
Does anyone have any other ideas or recommendations?

Sarah



More information about the Use-livecode mailing list