sort-values ( obj -- sortedseq ) (original) (raw)
sort-values ( obj -- sortedseq )
Factor handbook » The language » Collections » Sequence operations » Sorting sequences
Prev: | sort-keys ( obj -- sortedseq ) |
---|
Vocabulary
sorting
Inputs
obj | an object |
---|
Outputs
sortedseq | a new sorted sequence |
---|
Word description
Sorts the elements of obj (converting to an alist first if not a sequence), comparing second elements of pairs using the <=> word.
See also
compare, sort, sort-by, inv-sort-by, sort-keys
Definition
GENERIC: sort-values ( obj -- sortedseq )
Methods
USING: arrays assocs hashtables kernel.private sequences.private
sorting ;
M: hashtable sort-values
>alist [ { array } declare second-unsafe ] sort-by ;
USING: assocs kernel sorting ;
M: object sort-values >alist sort-values ;
USING: sequences sequences.private sorting sorting.private ;
M: sequence sort-values
1 check-bounds [ second-unsafe ] sort-by ;