sort-with ( seq quot: ( elt -- key ) -- sortedseq )
Factor handbook > The language > Collections > Sequence operations > Sorting sequences

Prev:sort ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
Next:inv-sort-with ( seq quot: ( elt -- key ) -- sortedseq )


Vocabulary
sorting

Inputs and outputs
seqa sequence
quota quotation with stack effect ( elt -- key )
sortedseqa 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, natural-sort, inv-sort-with, sort-keys, sort-values

Definition


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