-
Notifications
You must be signed in to change notification settings - Fork 6
library__sort
#sort
Functions to sort lists of elements.
The functions in this library come in three versions:
- simple sort: the list is sorted, duplicates and equivalent elements are kept;
- sort and remove duplicates: the list is sorted and duplicates are removed, however equivalent elements are kept (modifier: "u");
- sort and remove equivalents: the list is sorted and equivalent elements are removed (modifier: "n").
sort:comp(list, comparator)
Evaluates list as a list of elements, then sorts the result according to the expression comparator. The comparator expression is evaluated as an integer and must return a number below zero (lower than), zero (equals) or above zero (greater than).
sort:dval(list, value)
Evaluates list as a list of elements, then evaluates value as a double for each element. Returns the list sorted by value.
sort:ival(list, value)
Evaluates list as a list of elements, then evaluates value as an integer for each element. Returns the list sorted by value.
sort:ncomp(list, comparator)
Same as comp, remove equivalents.
sort:ndval(list, value)
Same as dval, remove equivalents.
sort:nival(list, value)
Same as ival, remove equivalents.
sort:nsval(list, value)
Same as sval, remove equivalents.
sort:reverse(list)
Evaluates list as a list of elements and returns this list reversed.
sort:sval(list, value)
Evaluates list as a list of elements, then evaluates value as a string for each element. Returns the list sorted by value (lexical sort).
sort:ucomp(list, comparator)
Same as comp, remove duplicates.
sort:udval(list, value)
Same as dval, remove duplicates.
sort:uival(list, value)
Same as ival, remove duplicates.
sort:usval(list, value)
Same as sval, remove duplicates.