1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax kernel math.order quotations
12 { $description "Splits a string on numbers and returns a sequence of sequences and integers." } ;
16 { "obj1" object } { "obj2" object }
17 { "<=>" "an ordering specifier" }
19 { $description "Compares two objects after converting numbers in the string into integers." } ;
23 { "obj1" object } { "obj2" object }
24 { ">=<" "an ordering specifier" }
26 { $description "Compares two objects using the " { $link human<=> } " word and inverts the result." } ;
28 ARTICLE: "sorting.human" "Human-friendly sorting"
29 "The " { $vocab-link "sorting.human" } " vocabulary sorts by numbers as a human would -- by comparing their magnitudes -- rather than in a lexicographic way. For example, sorting a1, a10, a03, a2 with human sort returns a1, a2, a03, a10, while sorting with natural sort returns a03, a1, a10, a2." $nl
30 "Comparing two objects:"
31 { $subsection human<=> }
32 { $subsection human>=< }
33 "Splitting a string into substrings and integers:"
34 { $subsection find-numbers } ;
36 ABOUT: "sorting.human"