sort-by ( ... seq quot: ( ... elt -- ... key ) -- ... sortedseq ) (original) (raw)

Vocabulary
sorting

Inputs

seq a sequence
quot a quotation with stack effect ( ... elt -- ... key )

Outputs

sortedseq a new sorted sequence

Word description
Sorts the elements of seq by applying compare with quot to each pair of elements in the sequence.

See also
compare, sort, inv-sort-by, sort-keys, sort-values

Definition

USING: kernel math.order ;

IN: sorting

: sort-by
( ... seq quot: ( ... elt -- ... key ) -- ... sortedseq )
[ compare ] curry sort-with ; inline