Reverse a list

Peter M. Brigham pmbrig at
Mon Feb 16 16:15:16 EST 2015

As I now understand it, the really big difference is between the repeat for n = 1 to… form on the one hand, and the repeat for each… and repeat n times forms. The latter 2 are not that different, but when the engine has to count lines/items every time, it slows things down a very significant amount.

But maybe I'm not really getting this yet.

-- Peter

Peter M. Brigham
pmbrig at

On Feb 16, 2015, at 4:02 PM, Mike Kerner wrote:

> I don't think I follow on the first part.  Edinburgh says that the
> complexity of the two traversals are dramatically different.  repeat for
> each is somewhere between nlogn and n, and repeat with is n^2.  At least
> for the case of your squares of integers, I would expect that there is a
> crossover where it's going to be faster to build the list, first.  I don't
> know if that is at 100, 1000, or some bigger number, but n vs. n^2 is a
> very big difference.

More information about the use-livecode mailing list