Reverse a list

Dave Cragg dave.cragg at lacscentre.co.uk
Mon Feb 9 17:26:26 EST 2015


Mark

Still no data. The problem is here:

> repeat for each line l in p

I would have been surprised if that had worked.

I also tried the following, but it give the same speed as my original (not surprising as it’s doing much the same thing)

function arevers p
  
  put the number of lines in p into tNumElems
  split p by cr
  put empty into t
  put tNumElems into tCount
  repeat tNumElems
     put p[tCount] & cr after t
     subtract 1 from tCount
  end repeat
  return t
end arevers




> On 9 Feb 2015, at 22:04, Mark Wieder <mwieder at ahsoftware.net> wrote:
> 
> Sorry - got one line out of place. Here ya go.
> Still the fastest yet.
> 
> function arevers p
>   local t
>   local tNumElems
> 
>   put the number of lines in p into tNumElems
>   split p by cr
>   put empty into t
>   repeat for each line l in p
>      put p[tNumElems] & cr after t
>      subtract 1 from tNumElems
>   end repeat
>   return t
> end arevers
> 
> -- 
> Mark Wieder
> ahsoftware at gmail.com
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list