[sc-users] Re: double sorting

Rohan Drape rd at slavepianos.org
Mon Dec 4 14:24:00 PST 2006


Tom Hall wrote:
> how can i sort first by l[0], then l[1]

l = [[2, "z"], [1, "z"], [1, "a"], [2, "a"]]

~cmp = {|a, b|
  if(a[0] == b[0],{a[1] < b[1]},{a[0] < b[0]});
};

l.sort(~cmp);

I can't recall how to write (compare a b => [EQ | GT | LT]) but that'd
avoid some work above.

Regards,
Rohan




More information about the sc-users mailing list