to Jaque and Sarah just one more modification:
numeric if you do the reverse sort the way it on eleven lines the word one to eleven on each then it returns: eleven ten one nine eight seven six five four three two if you add numeric it works correctly like in: function reverseList pList put the number of lines in pList into tCount sort lines of pList numeric by mySort() return pList end reverseList then it returns eleven ten nine eight seven six five four three two one So whatever the inner working of this algorithm without numeric it does not sort numerically on the number passed So for me without numeric it returns the wrong sort order if using more than ten lines. This could be possibly very confusing to detect. fwiw bernd Sarah Reichelt-2 wrote: > > And the winner is....... > > Jacque (with one modification). > > local tCount > > function reverseList pList > put the number of lines in pList into tCount > sort lines of pList by mySort() > return pList > end reverseList > > function mySort > subtract 1 from tCount > return tCount > end mySort > > I had thought that Jacque's must be faster than Jan's because Jan's > does more operations per cycle, but it was a bit slower. Then I > noticed that Jacque had used "sort lines of pList by mySort(each)" > where Jan had left out the "each". Deleting the "each" from Jacque's > function made it the fastest. Fractionally faster than Jan's, it takes > about 2/3 of the time of Mark's solution using arrays, and it way > faster than the string method. > > Thanks everyone - fun and instructive :-) > > Cheers, > Sarah > _______________________________________________ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution > > -- View this message in context: http://www.nabble.com/Reversing-a-list-tp16466585p16489681.html Sent from the Revolution - User mailing list archive at Nabble.com. _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution