20 lines
930 B
Plaintext
20 lines
930 B
Plaintext
|
|
IN: sequences
|
||
|
|
USING: help words ;
|
||
|
|
|
||
|
|
HELP: sort "( seq quot -- sortedseq )"
|
||
|
|
{ $values { "seq" "a sequence" } { "quot" "a comparator quotation" } { "sortedseq" "a new sorted sequence" } }
|
||
|
|
{ $description "Sorts the elements into a new sequence of the same class as " { $snippet "seq" } "." } ;
|
||
|
|
|
||
|
|
HELP: nsort "( seq quot -- sortedseq )"
|
||
|
|
{ $values { "seq" "a mutable sequence" } { "quot" "a comparator quotation" } { "sortedseq" "a new sorted sequence" } }
|
||
|
|
{ $description "Sorts the sequence in-place." }
|
||
|
|
{ $side-effects "seq" } ;
|
||
|
|
|
||
|
|
HELP: number-sort "( seq -- sortedseq )"
|
||
|
|
{ $values { "seq" "a sequence of real numbers" } { "sortedseq" "a new sorted sequence" } }
|
||
|
|
{ $description "Sorts a sequence of real numbers in increasing order." } ;
|
||
|
|
|
||
|
|
HELP: string-sort "( seq -- sortedseq )"
|
||
|
|
{ $values { "seq" "a sequence of strings" } { "sortedseq" "a new sorted sequence" } }
|
||
|
|
{ $description "Sorts a sequence of strings in increasing order." } ;
|