the prime have other Hidden functions?
|
07-04-2015, 08:34 PM
Post: #6
|
|||
|
|||
RE: the prime have other Hidden functions?
(07-04-2015 04:52 PM)Tim Wessman Wrote:(07-04-2015 11:22 AM)BruceH Wrote: The SORT command appears to have an undocumented "rotate left" capability. ;-) Thanks Tim. So something like... a) A simple option is to allow SORT to take a second list as a second parameter. Given Code: name := { "Bird", "Jordan", "O'Neal" } then SORT(name, height) would return names ordered by height. Conveniently this doesn't break any existing code as SORT currently only takes one parameter. Dependent lists could be as simple as SORT(name, age, height) but the problem here is a conceptual one: what is the return value (as two lists are changing but only one can be returned)? I think it will be fine just to do: Code: name := SORT(name, height); b) A more powerful version, drawing on the ANSI C "qsort" approach, allows the user to specify a comparison function e.g.: Code: SORTB("compare(a,b)", { {"Bird",2.06}, {"Jordan",1.98}, {"O'Neal",2.16} } ) |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
the prime have other Hidden functions? - dajiang1314 - 07-03-2015, 02:03 AM
RE: the prime have other Hidden functions? - Joe Horn - 07-03-2015, 05:18 PM
RE: the prime have other Hidden functions? - DrD - 07-03-2015, 05:28 PM
RE: the prime have other Hidden functions? - BruceH - 07-04-2015, 11:22 AM
RE: the prime have other Hidden functions? - Tim Wessman - 07-04-2015, 04:52 PM
RE: the prime have other Hidden functions? - BruceH - 07-04-2015 08:34 PM
RE: the prime have other Hidden functions? - parisse - 07-05-2015, 05:10 AM
RE: the prime have other Hidden functions? - BruceH - 07-05-2015, 07:25 AM
RE: the prime have other Hidden functions? - Arno K - 07-05-2015, 06:22 PM
|
User(s) browsing this thread: 1 Guest(s)