Reversing a list

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Apr 3 06:44:11 EDT 2008


Hi Sarah,

After a little discussion in ChatRev, this is what I end up with:

function reverseList theListArray
   split theListArray by cr
   put the keys of theListArray
   combine theListArray by cr and tab
   sort lines of theListArray numeric descending by item 1 of each
   split theListArray by column
   return theListArray[2]
end reverseList

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

A large collection of scripts for HyperCard, Revolution, SuperCard and  
other programming languages can be found at http://runrev.info




On 3 apr 2008, at 06:00, Sarah Reichelt wrote:
> OK people, what's the fastest way to reverse the order of lines in a
> list. I have a list of images gathered together by filtering matching
> files from a set of folders. Now I want to be able to reverse the
> order, but their file names are varied and so I have no obvious way to
> sort them.
>
> I realise I could just use a repeat for each loop and put each one
> before a new list variable, but that seems rather clumsy, and using
> "before" slows down when I have thousands of records.
>
> I'm hoping that Jacque will chime in with one of her custom sort ideas
> that I never can think of, but anyone is welcome to come up with some
> elegant solution.
>
> Cheers,
> Sarah
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list