Handbook
Glossary
map-sort ( ... seq quot: ( ... elt -- ... key ) -- ... sortedseq )
Vocabulary
sorting
.
extras
Inputs
seq
a
sequence
quot
a
quotation
with stack effect
( ... elt -- ... key )
Outputs
sortedseq
a new sorted sequence
Word description
Sort the elements of
seq
a sequence using
quot
as a key function.
Definition
USING:
arrays
assocs
kernel
kernel.private
sequences
sequences.private
sorting
;
IN:
sorting.extras
:
map-sort
( ... seq quot: ( ... elt -- ... key ) -- ... sortedseq )
[
keep
]
curry
map>alist
[
{
array
}
declare
first-unsafe
]
sort-by
[
{
array
}
declare
second-unsafe
]
map
;
inline