Handbook
Glossary
sort-with ( ... seq quot: ( ... obj1 obj2 -- ... <=> ) -- ... sortedseq )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Sorting sequences
Next:
sort ( seq -- sortedseq )
Vocabulary
sorting
Inputs
seq
a
sequence
quot
a
quotation
with stack effect
( ... obj1 obj2 -- ... <=> )
Outputs
sortedseq
a new sorted sequence
Word description
Sorts the elements of
seq
into a new array using a stable sort.
Notes
The algorithm used is the merge sort.
Definition
USING:
accessors
kernel
sorting.private
;
IN:
sorting
:
sort-with
( ... seq quot: ( ... obj1 obj2 -- ... <=> ) -- ... sortedseq )
[
<merge>
]
dip
[
sort-pairs
]
[
sort-loop
]
[
drop
accum>>
underlying>>
]
2tri
;
inline