sort ... by ... of each is far more powerful than I knew
Richard Gaskin
ambassador at fourthworld.com
Mon Sep 16 09:50:46 EDT 2013
If someone has time on their hands it might be fun to see what Python
and JavaScript versions of each of those would look like.
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
Follow me on Twitter: http://twitter.com/FourthWorldSys
Geoff Canyon wrote:
> I just blew my own mind. Maybe I'm slow, but I had no idea any of this
> would work. I started with this data in a field.
>
> test 1,this,5,apple
> test 2,the,-2,pear
> test 3,a,2,grape
> test 4,oh,0,strawberry
>
> Then I put a copy of that data in x and sorted it with various commands as
> follows:
>
> sort lines of x numeric ascending by item 3 of each
>
> test 2,the,-2,pear
> test 4,oh,0,strawberry
> test 3,a,2,grape
> test 1,this,5,apple
>
>
> sort lines of x numeric ascending by item 3 of each * word 2 of item 1
> of each
>
> test 2,the,-2,pear
> test 4,oh,0,strawberry
> test 1,this,5,apple
> test 3,a,2,grape
>
>
> sort lines of x numeric descending by abs(item 3 of each * word 2 of
> item 1 of each)
>
> test 3,a,2,grape
> test 1,this,5,apple
> test 2,the,-2,pear
> test 4,oh,0,strawberry
>
>
> sort lines of x by item 3 of each > word 2 of item 1 of each
>
> test 2,the,-2,pear
> test 3,a,2,grape
> test 4,oh,0,strawberry
> test 1,this,5,apple
>
>
> sort lines of x by (item 3 of each > word 2 of item 1 of each) && item 4
> of each
>
> test 3,a,2,grape
> test 2,the,-2,pear
> test 4,oh,0,strawberry
> test 1,this,5,apple
>
>
> sort lines of x numeric descending by length(item 4 of each) - (item 3
> of each)
>
> test 4,oh,0,strawberry
> test 2,the,-2,pear
> test 3,a,2,grape
> test 1,this,5,apple
More information about the use-livecode
mailing list