[LUNI] Sorting algorithm in perl?
lembark at wrkhors.com
Fri Mar 22 23:45:08 CST 2002
> anArray.sort(lambda x,y: cmp(x,y) or cmp(x,y))
Trick is to use anonymous structures for it in Perl (basically
the same technique you'd use in Lisp(where Randal got the basic
idea for the Schwartzian Transform(which is really just tacking
on a car for the sort and taking a cdr off the end when you're
Main problem with the technique above is that you have to
hard-code the offsets. With a list based technique you can
pass in a list of sort offsets and deal with the entire
thing dynamically (see previous posting).
Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647
+1 800 762 1582
More information about the luni