(rontolisp) docs
← cl Package Functions

sort

(sort sequence predicate)

Sorts sequence using predicate, a two-argument comparison function that returns non-nil when its first argument should precede its second. A list is sorted destructively: its cons cells are rearranged in place, so use the return value rather than the original variable. A vector, or a string the program built (not a literal), is likewise sorted in its own storage and comes back as the same object -- a fill-pointered or adjustable one keeps its fill pointer and its adjustable flag. A program-text string literal cannot be written in place, so sorting one returns a fresh string instead. Either way, use the return value rather than the original variable. The relative order of elements predicate considers equal is unspecified; use stable-sort when it matters.