sort ... by ... of each is far more powerful than I knew

Geoff Canyon gcanyon at gmail.com
Mon Sep 16 04:11:16 EDT 2013


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