]> gitweb.factorcode.org Git - factor.git/commitdiff
Rename and add sorting words
authorGiftpflanze <gifti@tools.wmflabs.org>
Wed, 1 Feb 2023 17:27:34 +0000 (17:27 +0000)
committerGiftpflanze <80504430+gifti258@users.noreply.github.com>
Wed, 8 Feb 2023 06:05:43 +0000 (07:05 +0100)
sorting:
natural-sort → sort
sort → sort-with
sort-with → sort-by
+ inv-sort
+ inv-sort-with
inv-sort-with → inv-sort-by
+ inv-sort-keys
+ inv-sort-values

sorting.slots → sorting.specification:
compare-slots → compare-with-spec
sort-by → sort-with-spec
sort-by-with → sort-with-spec-by
sort-keys-by → sort-keys-with-spec
sort-values-by → sort-values-with-spec

sorting.quick:
natural-sort! → sort!
sort! → sort-with!
sort-with! → sort-by!
+ inv-sort!
+ inv-sort-with!
inv-sort-with! → inv-sort-by!

sorting.bubble:
natural-bubble-sort! → bubble-sort!
bubble-sort! → bubble-sort-with!

163 files changed:
basis/channels/channels-tests.factor
basis/compiler/cfg/dominance/dominance.factor
basis/compiler/cfg/linear-scan/assignment/assignment-tests.factor
basis/compiler/cfg/linearization/linearization.factor
basis/compiler/cfg/ssa/destruction/coalescing/coalescing.factor
basis/compiler/cfg/ssa/interference/interference.factor
basis/compiler/cfg/stacks/padding/padding-tests.factor
basis/compiler/tests/redefine5.factor
basis/compiler/tests/redefine8.factor
basis/compiler/tests/redefine9.factor
basis/compiler/tree/debugger/debugger-tests.factor
basis/compiler/tree/debugger/debugger.factor
basis/compiler/tree/def-use/def-use-tests.factor
basis/compiler/tree/def-use/simplified/simplified-tests.factor
basis/compiler/tree/propagation/propagation-tests.factor
basis/compiler/tree/tuple-unboxing/tuple-unboxing-tests.factor
basis/compression/huffman/huffman.factor
basis/compression/inflate/inflate.factor
basis/cpu/arm/assembler/32/32.factor
basis/cpu/arm/assembler/64/64.factor
basis/cpu/arm/assembler/assembler.factor
basis/cpu/arm/assembler/opcodes/opcodes.factor
basis/db/sqlite/sqlite-tests.factor
basis/db/tuples/tuples-tests.factor
basis/editors/vim/generate-syntax/generate-syntax.factor
basis/escape-strings/escape-strings.factor
basis/fixups/fixups.factor
basis/globs/globs-tests.factor
basis/heaps/heaps-tests.factor
basis/help/apropos/apropos.factor
basis/help/search/search.factor
basis/help/vocabs/vocabs.factor
basis/http/server/static/static.factor
basis/interval-maps/interval-maps.factor
basis/io/directories/directories-tests.factor
basis/math/primes/factors/factors.factor
basis/math/primes/pollard-rho-brent/pollard-rho-brent.factor
basis/math/statistics/statistics.factor
basis/mime/multipart/multipart-tests.factor
basis/models/sort/sort.factor
basis/regexp/minimize/minimize.factor
basis/see/see.factor
basis/sequences/parser/parser.factor
basis/sorting/human/human-tests.factor
basis/sorting/human/human.factor
basis/sorting/slots/authors.txt [deleted file]
basis/sorting/slots/slots-docs.factor [deleted file]
basis/sorting/slots/slots-tests.factor [deleted file]
basis/sorting/slots/slots.factor [deleted file]
basis/sorting/slots/summary.txt [deleted file]
basis/sorting/specification/authors.txt [new file with mode: 0644]
basis/sorting/specification/specification-docs.factor [new file with mode: 0644]
basis/sorting/specification/specification-tests.factor [new file with mode: 0644]
basis/sorting/specification/specification.factor [new file with mode: 0644]
basis/sorting/specification/summary.txt [new file with mode: 0644]
basis/sorting/title/title-tests.factor
basis/splitting/monotonic/monotonic.factor
basis/suffix-arrays/suffix-arrays.factor
basis/tools/annotations/annotations.factor
basis/tools/coverage/coverage-tests.factor
basis/tools/crossref/crossref.factor
basis/tools/destructors/destructors.factor
basis/tools/files/files.factor
basis/tools/memory/memory.factor
basis/tools/profiler/sampling/sampling.factor
basis/tools/scaffold/scaffold.factor
basis/ui/gadgets/grid-lines/grid-lines-tests.factor
basis/ui/gadgets/menus/menus.factor
basis/ui/tools/inspector/inspector.factor
basis/unicode/unicode.factor
basis/unix/linux/proc/proc.factor
basis/vocabs/hierarchy/hierarchy.factor
basis/vocabs/metadata/resources/resources-tests.factor
basis/vocabs/prettyprint/prettyprint.factor
basis/xmode/catalog/catalog.factor
basis/xmode/keyword-map/keyword-map.factor
core/classes/algebra/algebra.factor
core/classes/classes-tests.factor
core/graphs/graphs-tests.factor
core/hash-sets/hash-sets-tests.factor
core/sets/sets-tests.factor
core/sorting/sorting-docs.factor
core/sorting/sorting-tests.factor
core/sorting/sorting.factor
core/source-files/errors/errors.factor
core/vocabs/parser/parser.factor
core/vocabs/vocabs.factor
extra/alien/fortran/fortran.factor
extra/anagrams/anagrams.factor
extra/annotations/annotations-docs.factor
extra/benchmark/interval-sets/interval-sets.factor
extra/benchmark/sort/sort.factor
extra/benchmark/splay/splay.factor
extra/build-from-source/windows/windows.factor
extra/c/lexer/lexer.factor
extra/codebook/codebook.factor
extra/color-table/color-table.factor
extra/command-loop/command-loop.factor
extra/compiler/cfg/gvn/testing/testing.factor
extra/contributors/contributors.factor
extra/cursors/cursors-tests.factor
extra/did-you-mean/did-you-mean.factor
extra/enigma/enigma-tests.factor
extra/fuel/xref/xref.factor
extra/gemini/server/server.factor
extra/gml/core/core.factor
extra/gopher/server/server.factor
extra/gpu/render/render.factor
extra/help/lint/coverage/coverage-tests.factor
extra/help/lint/coverage/coverage.factor
extra/ifaddrs/ifaddrs.factor
extra/images/atlas/atlas.factor
extra/koszul/koszul.factor
extra/lint/vocabs/vocabs.factor
extra/lru-cache/lru-cache-tests.factor
extra/machine-learning/decision-trees/decision-trees.factor
extra/machine-learning/label-binarizer/label-binarizer.factor
extra/machine-learning/label-encoder/label-encoder.factor
extra/managed-server/chat/chat.factor
extra/mason/test/test.factor
extra/math/extras/extras.factor
extra/math/transforms/bwt/bwt.factor
extra/memcached/memcached-tests.factor
extra/multi-methods/multi-methods.factor
extra/pair-methods/pair-methods.factor
extra/papier/render/render.factor
extra/path-finding/path-finding-tests.factor
extra/project-euler/004/004.factor
extra/project-euler/009/009.factor
extra/project-euler/022/022.factor
extra/project-euler/043/043.factor
extra/project-euler/052/052.factor
extra/project-euler/062/062.factor
extra/project-euler/112/112.factor
extra/project-euler/common/common.factor
extra/punycode/punycode.factor
extra/quadtrees/quadtrees-tests.factor
extra/redis/redis-tests.factor
extra/reports/noise/noise.factor
extra/rosetta-code/anagrams-deranged/anagrams-deranged.factor
extra/rosetta-code/count-the-coins/count-the-coins.factor
extra/rosetta-code/knapsack/knapsack.factor
extra/rosetta-code/top-rank/top-rank.factor
extra/s3/s3.factor
extra/semver/semver-tests.factor
extra/snake-game/game/game.factor
extra/sorting/bubble/bubble-tests.factor
extra/sorting/bubble/bubble.factor
extra/sorting/extras/extras.factor
extra/sorting/quick/quick-tests.factor
extra/sorting/quick/quick.factor
extra/spelling/spelling.factor
extra/tools/tree/tree.factor
extra/units/units.factor
extra/webapps/blogs/blogs.factor
extra/webapps/mason/dashboard/dashboard.factor
extra/webapps/pastebin/pastebin.factor
extra/webapps/planet/planet.factor
extra/webapps/wiki/wiki.factor
extra/wordlet/wordlet.factor
extra/wordtimer/wordtimer.factor
extra/zoneinfo/zoneinfo.factor
misc/vim/syntax/factor/generated.vim

index ab7f164003bb5b0ebb744a56fd4439640077aa23..cdb9429fdd215c8b74b850ba52662f7e40de1ef7 100644 (file)
@@ -24,7 +24,7 @@ USING: channels kernel sequences sorting threads tools.test ;
     2 over to
     1 over to
     3 swap to
     2 over to
     1 over to
     3 swap to
-    natural-sort
+    sort
 ] unit-test
 
 { { 1 2 4 9 } } [
 ] unit-test
 
 { { 1 2 4 9 } } [
@@ -37,5 +37,5 @@ USING: channels kernel sequences sorting threads tools.test ;
     2dup from swap push
     2dup from swap push
     dupd from swap push
     2dup from swap push
     2dup from swap push
     dupd from swap push
-    natural-sort
+    sort
 ] unit-test
 ] unit-test
index 230022e8dff124a2ba4aa3cc5fb6e7ecb19b6dd5..75a4523fa868f02c7dfd2b6b97eddf9369636e0c 100644 (file)
@@ -47,7 +47,7 @@ PRIVATE>
 
 : compute-dom-children ( dom-parents -- dom-childrens )
     H{ } clone [ '[ 2dup eq? [ 2drop ] [ _ push-at ] if ] assoc-each ] keep
 
 : compute-dom-children ( dom-parents -- dom-childrens )
     H{ } clone [ '[ 2dup eq? [ 2drop ] [ _ push-at ] if ] assoc-each ] keep
-    [ [ number>> ] sort-with ] assoc-map ;
+    [ [ number>> ] sort-by ] assoc-map ;
 
 SYMBOLS: preorder maxpreorder ;
 
 
 SYMBOLS: preorder maxpreorder ;
 
index 354958a40b2d909f0595a5369c63f7ae79ace916..e1c4610d3cec74ac40416ed482f9942cb7060f09 100644 (file)
@@ -220,5 +220,5 @@ IN: compiler.cfg.linear-scan.assignment.tests
 
 { { 3 56 } } [
     { { 3 7 } { -1 56 } { -1 3 } } >min-heap [ -1 = ] heap-pop-while
 
 { { 3 56 } } [
     { { 3 7 } { -1 56 } { -1 3 } } >min-heap [ -1 = ] heap-pop-while
-    natural-sort
+    sort
 ] unit-test
 ] unit-test
index 98af558f6a9a3bddc2b5eb5e8e4dd52d6e7ce5fb..850ef1f562344d7963139b06252aeec8eaef8dba 100644 (file)
@@ -38,7 +38,7 @@ SYMBOLS: loop-heads visited ;
     ] if ;
 
 : sorted-successors ( bb -- seq )
     ] if ;
 
 : sorted-successors ( bb -- seq )
-    successors>> <reversed> [ loop-nesting-at ] sort-with ;
+    successors>> <reversed> [ loop-nesting-at ] sort-by ;
 
 : process-block ( bb -- bbs )
     dup visited get ?adjoin [ dup , sorted-successors ] [ drop { } ] if
 
 : process-block ( bb -- bbs )
     dup visited get ?adjoin [ dup , sorted-successors ] [ drop { } ] if
index e488b320d028aed7409a881190825350afc0c045..69d8aaeedd871c8a1cf2e952034790a3b32df101 100644 (file)
@@ -54,7 +54,7 @@ M: ##tagged>integer coalesce-now
 
 M: ##phi coalesce-now
     [ dst>> ] [ inputs>> values ] bi zip-scalar
 
 M: ##phi coalesce-now
     [ dst>> ] [ inputs>> values ] bi zip-scalar
-    natural-sort t try-eliminate-copies ;
+    sort t try-eliminate-copies ;
 
 GENERIC: coalesce-later ( insn -- )
 
 
 GENERIC: coalesce-later ( insn -- )
 
index b20e639658a97621097442408a5eba4b4d38182a..448a96c96d375cd66e314a9b978e117e8d52e3cb 100644 (file)
@@ -2,7 +2,7 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays combinators combinators.short-circuit
 compiler.cfg.dominance compiler.cfg.ssa.interference.live-ranges
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays combinators combinators.short-circuit
 compiler.cfg.dominance compiler.cfg.ssa.interference.live-ranges
-kernel locals math math.order sequences sorting.slots ;
+kernel locals math math.order sequences sorting.specification ;
 IN: compiler.cfg.ssa.interference
 
 TUPLE: vreg-info vreg value def-index bb pre-of color equal-anc-in equal-anc-out ;
 IN: compiler.cfg.ssa.interference
 
 TUPLE: vreg-info vreg value def-index bb pre-of color equal-anc-in equal-anc-out ;
@@ -89,7 +89,7 @@ TUPLE: vreg-info vreg value def-index bb pre-of color equal-anc-in equal-anc-out
 
 ! Merging lists of vregs sorted by dominance.
 M: vreg-info <=> ( vreg1 vreg2 -- <=> )
 
 ! Merging lists of vregs sorted by dominance.
 M: vreg-info <=> ( vreg1 vreg2 -- <=> )
-    { { pre-of>> <=> } { def-index>> <=> } } compare-slots ;
+    { { pre-of>> <=> } { def-index>> <=> } } compare-with-spec ;
 
 SYMBOLS: blue red ;
 
 
 SYMBOLS: blue red ;
 
index 1c628a08204dad22ba49116197a493ba0fd54d5f..07fd0497734327195b3242817770afba748d569d 100644 (file)
@@ -122,7 +122,7 @@ IN: compiler.cfg.stacks.padding.tests
 
 : following-stack-state ( insns -- state )
     T{ ##branch } suffix insns>cfg trace-stack-state
 
 : following-stack-state ( insns -- state )
     T{ ##branch } suffix insns>cfg trace-stack-state
-    >alist [ first ] sort-with last second ;
+    >alist [ first ] sort-by last second ;
 
 ! trace-stack-state
 {
 
 ! trace-stack-state
 {
index b027230a481c29895f2d59e0924fb48c1a2714fd..2e0e7863937905ca15ecf5baf61fbeed61abd7b1 100644 (file)
@@ -10,7 +10,7 @@ IN: compiler.tests.redefine5
     "USING: sorting kernel math.order ;
     IN: compiler.tests.redefine5
     GENERIC: my-generic ( a -- b )
     "USING: sorting kernel math.order ;
     IN: compiler.tests.redefine5
     GENERIC: my-generic ( a -- b )
-    M: object my-generic [ <=> ] sort ;
+    M: object my-generic sort ;
     : my-inline ( a -- b ) my-generic ;"
     eval( -- )
 ] unit-test
     : my-inline ( a -- b ) my-generic ;"
     eval( -- )
 ] unit-test
index 874cb2633ecec08cfe9cdac0d903677b4eae5155..3e10b0c9519434b9b51440b37cd16b46fa47262f 100644 (file)
@@ -14,7 +14,7 @@ IN: compiler.tests.redefine8
     GENERIC: my-generic ( a -- b )
     ! We add the bogus quotation here to hinder inlining
     ! since otherwise we cannot trigger this bug.
     GENERIC: my-generic ( a -- b )
     ! We add the bogus quotation here to hinder inlining
     ! since otherwise we cannot trigger this bug.
-    M: my-mixin my-generic 1 + [ [ <=> ] sort ] drop ;"
+    M: my-mixin my-generic 1 + [ sort ] drop ;"
     eval( -- )
 ] unit-test
 
     eval( -- )
 ] unit-test
 
index b8320d67490479ebe51830b1a8ce748a002f69b2..57ec3c8b268b9348093519360b905331d878ec72 100644 (file)
@@ -14,7 +14,7 @@ IN: compiler.tests.redefine9
     GENERIC: my-generic ( a -- b )
     ! We add the bogus quotation here to hinder inlining
     ! since otherwise we cannot trigger this bug.
     GENERIC: my-generic ( a -- b )
     ! We add the bogus quotation here to hinder inlining
     ! since otherwise we cannot trigger this bug.
-    M: my-mixin my-generic 1 + [ [ <=> ] sort ] drop ;"
+    M: my-mixin my-generic 1 + [ sort ] drop ;"
     eval( -- )
 ] unit-test
 
     eval( -- )
 ] unit-test
 
index 3cdbbf594436217af2d7447fc348b856cd63f9ce..3902f9f59646f761e4b066b597354c803b77769d 100644 (file)
@@ -1,5 +1,5 @@
 USING: compiler.tree.debugger tools.test sorting sequences io math.order ;
 IN: compiler.tree.debugger.tests
 
 USING: compiler.tree.debugger tools.test sorting sequences io math.order ;
 IN: compiler.tree.debugger.tests
 
-[ [ <=> ] sort ] optimized.
+[ [ <=> ] sort-with ] optimized.
 [ <reversed> [ print ] each ] optimizer-report.
 [ <reversed> [ print ] each ] optimizer-report.
index ea585e0ce0cc23021d9e3f30a2dea69b203d2977..c2c0f2e0bedf4729920c92b9d7214b358b6fedda 100644 (file)
@@ -174,7 +174,7 @@ SYMBOL: node-count
             { methods-called "==== Non-inlined method calls:" }
             { intrinsics-called "==== Open-coded intrinsic calls:" }
         } [
             { methods-called "==== Non-inlined method calls:" }
             { intrinsics-called "==== Open-coded intrinsic calls:" }
         } [
-            nl print get keys natural-sort stack.
+            nl print get keys sort stack.
         ] assoc-each
     ] with-variables ;
 
         ] assoc-each
     ] with-variables ;
 
index ac401cf5319c488b6433c1a267413292b9a2f38d..08a3d232451b1d368074ce09dcc20d424c535914 100644 (file)
@@ -52,7 +52,7 @@ IN: compiler.tree.def-use.tests
     [ [ 1 ] [ 2 ] compose swap [ 1 ] [ 2 ] if + * ]
     [ dup slice? [ dup array? [ ] [ ] if ] [ ] if ]
     [ dup [ drop f ] [ "A" throw ] if ]
     [ [ 1 ] [ 2 ] compose swap [ 1 ] [ 2 ] if + * ]
     [ dup slice? [ dup array? [ ] [ ] if ] [ ] if ]
     [ dup [ drop f ] [ "A" throw ] if ]
-    [ [ <=> ] sort ]
+    [ [ <=> ] sort-with ]
     [ [ <=> ] with search ]
 } [
     [ ] swap [ test-def-use ] curry unit-test
     [ [ <=> ] with search ]
 } [
     [ ] swap [ test-def-use ] curry unit-test
index c810230f4d3b2ac7e23a410a0aac309232979240..40d6fd748d1593911444bf3295a9fb4915e34080 100644 (file)
@@ -6,7 +6,7 @@ IN: compiler.tree.def-use.simplified
 { { #call #return } } [
     [ 1 dup reverse ] build-tree compute-def-use
     first out-d>> first actually-used-by
 { { #call #return } } [
     [ 1 dup reverse ] build-tree compute-def-use
     first out-d>> first actually-used-by
-    [ node>> class-of ] map natural-sort
+    [ node>> class-of ] map sort
 ] unit-test
 
 : word-1 ( a -- b ) dup [ word-1 ] when ; inline recursive
 ] unit-test
 
 : word-1 ( a -- b ) dup [ word-1 ] when ; inline recursive
@@ -14,11 +14,11 @@ IN: compiler.tree.def-use.simplified
 { { #introduce } } [
     [ word-1 ] build-tree analyze-recursive compute-def-use
     last in-d>> first actually-defined-by
 { { #introduce } } [
     [ word-1 ] build-tree analyze-recursive compute-def-use
     last in-d>> first actually-defined-by
-    [ node>> class-of ] map natural-sort
+    [ node>> class-of ] map sort
 ] unit-test
 
 { { #if #return } } [
     [ word-1 ] build-tree analyze-recursive compute-def-use
     first out-d>> first actually-used-by
 ] unit-test
 
 { { #if #return } } [
     [ word-1 ] build-tree analyze-recursive compute-def-use
     first out-d>> first actually-used-by
-    [ node>> class-of ] map natural-sort
+    [ node>> class-of ] map sort
 ] unit-test
 ] unit-test
index 83dd33f5f97aeb56b7f418e2fd92c0a7ad4aeb46..ee6bd7f60975d373208a3780645a594aba647775 100644 (file)
@@ -884,7 +884,7 @@ MIXIN: empty-mixin
 
 { V{ t } } [ [ macosx unix? ] final-literals ] unit-test
 
 
 { V{ t } } [ [ macosx unix? ] final-literals ] unit-test
 
-{ V{ array } } [ [ [ <=> ] sort [ <=> ] sort ] final-classes ] unit-test
+{ V{ array } } [ [ [ <=> ] sort-with [ <=> ] sort-with ] final-classes ] unit-test
 
 { V{ float } } [ [ fsqrt ] final-classes ] unit-test
 
 
 { V{ float } } [ [ fsqrt ] final-classes ] unit-test
 
index 331b2016907447890addc3d4655a91c5471f4861..06e1109fc7d198895c43ed630bff55f678587f4b 100644 (file)
@@ -33,7 +33,7 @@ TUPLE: empty-tuple ;
     [ [ ] [ ] curry curry dup 2 slot swap 3 slot dup 2 slot swap 3 slot drop ]
     [ [ ] [ ] curry curry call ]
     [ 1 cons boa over [ "A" throw ] when car>> ]
     [ [ ] [ ] curry curry dup 2 slot swap 3 slot dup 2 slot swap 3 slot drop ]
     [ [ ] [ ] curry curry call ]
     [ 1 cons boa over [ "A" throw ] when car>> ]
-    [ [ <=> ] sort ]
+    [ [ <=> ] sort-with ]
     [ [ <=> ] with search ]
     [ cons boa car>> void { } cdecl [ ] alien-callback ]
 } [ [ ] swap [ test-unboxing ] curry unit-test ] each
     [ [ <=> ] with search ]
     [ cons boa car>> void { } cdecl [ ] alien-callback ]
 } [ [ ] swap [ test-unboxing ] curry unit-test ] each
index 6f050b9eff36c9afd7b27aad9bdca65fbf781765..6f7559ca49658b63d4089037144c94472367a11a 100644 (file)
@@ -110,7 +110,7 @@ TUPLE: huffman-tree
     } cond ;
 
 : sort-values! ( obj -- sortedseq )
     } cond ;
 
 : sort-values! ( obj -- sortedseq )
-    >alist [ <==> ] sort ;
+    >alist [ <==> ] sort-with ;
 
 : get-next-code ( code current -- next )
     [ reverse bit-array>integer 1 + ] [ length ] bi <bits> >bit-array reverse dup length pick length swap - [ f ] replicate append nip ;
 
 : get-next-code ( code current -- next )
     [ reverse bit-array>integer 1 + ] [ length ] bi <bits> >bit-array reverse dup length pick length swap - [ f ] replicate append nip ;
index fdc6b81e1252eb81f14f3e715761bbc173d48df1..41f248aef1bbe949713e3482039310d7fbfa3ed1 100644 (file)
@@ -49,7 +49,7 @@ CONSTANT: clen-shuffle { 16 17 18 0 8 7 9 6 10 5 11 4 12 3 13 2 14 1 15 }
 : get-table ( values size -- table )
     16 f <array> <enumerated>
     [ '[ _ push-at ] 2each ] keep
 : get-table ( values size -- table )
     16 f <array> <enumerated>
     [ '[ _ push-at ] 2each ] keep
-    seq>> rest-slice [ natural-sort ] map ; inline
+    seq>> rest-slice [ sort ] map ; inline
 
 :: decode-huffman-tables ( bitstream -- tables )
     5 bitstream bs:read 257 +
 
 :: decode-huffman-tables ( bitstream -- tables )
     5 bitstream bs:read 257 +
index e9ac53579869b7bc44bb0bc3792cb4846bbf2a1d..7c70a7663e112adc9c8a1d376f39d04027be77b5 100644 (file)
@@ -1,4 +1,5 @@
 ! Copyright (C) 2023 Doug Coleman.
 ! Copyright (C) 2023 Doug Coleman.
+! Copyright (C) 2023 Giftpflanze.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: cpu.arm.assembler cpu.arm.assembler.opcodes kernel math ;
 IN: cpu.arm.assembler.32
 ! See https://factorcode.org/license.txt for BSD license.
 USING: cpu.arm.assembler cpu.arm.assembler.opcodes kernel math ;
 IN: cpu.arm.assembler.32
index 837c4a062b6289970a16b8902600e584f90fd064..7af57545198cffe341359afe8c1ea7322e221a56 100644 (file)
@@ -1,4 +1,5 @@
 ! Copyright (C) 2023 Doug Coleman.
 ! Copyright (C) 2023 Doug Coleman.
+! Copyright (C) 2023 Giftpflanze.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: cpu.arm.assembler cpu.arm.assembler.opcodes kernel math
 math.bitwise ;
 ! See https://factorcode.org/license.txt for BSD license.
 USING: cpu.arm.assembler cpu.arm.assembler.opcodes kernel math
 math.bitwise ;
index ff9a81a511803d8aa78fc9ebc8bf41a2009a22f9..891a53066bb5824bada7ad55a1cbd335357459ca 100644 (file)
@@ -1,4 +1,5 @@
 ! Copyright (C) 2020 Doug Coleman.
 ! Copyright (C) 2020 Doug Coleman.
+! Copyright (C) 2023 Giftpflanze.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: combinators cpu.arm.assembler.opcodes grouping kernel
 math math.bitwise math.parser sequences ;
 ! See https://factorcode.org/license.txt for BSD license.
 USING: combinators cpu.arm.assembler.opcodes grouping kernel
 math math.bitwise math.parser sequences ;
index 461bb027e73851fa5237a2d9708fa59e9d546122..458a6f7e09b0563d8b933523e57f8bac2ec2aad4 100644 (file)
@@ -1,4 +1,5 @@
 ! Copyright (C) 2020 Doug Coleman.
 ! Copyright (C) 2020 Doug Coleman.
+! Copyright (C) 2023 Giftpflanze.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors assocs classes.error classes.parser effects
 effects.parser endian kernel lexer make math math.bitwise
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors assocs classes.error classes.parser effects
 effects.parser endian kernel lexer make math math.bitwise
index 7a2dc8e2326a12bbc3ac61efce650b9995ac0b5e..0ece1abb05449939d0ff4b995209b96a3e19015d 100644 (file)
@@ -137,7 +137,7 @@ things "THINGS" {
         1 1 things boa insert-tuple
         1 0 things boa insert-tuple
         f f things boa select-tuples
         1 1 things boa insert-tuple
         1 0 things boa insert-tuple
         f f things boa select-tuples
-        [ [ one>> ] [ two>> ] bi 2array ] map natural-sort
+        [ [ one>> ] [ two>> ] bi 2array ] map sort
        things drop-table
     ] with-db
 ] unit-test
        things drop-table
     ] with-db
 ] unit-test
index e0f7e441d970994232d6f75b4364199150e641a8..ceec0b1decb0ff59b14ea2aa3b65579f4a99cad1 100644 (file)
@@ -680,7 +680,7 @@ select-me "select_me"
     [ { "test" "test2" } ] [
         select-me new NULL >>data [ "test" >>data ] update-tuples
         select-me new [ data>> ] collector [ each-tuple ] dip
     [ { "test" "test2" } ] [
         select-me new NULL >>data [ "test" >>data ] update-tuples
         select-me new [ data>> ] collector [ each-tuple ] dip
-        natural-sort
+        sort
     ] unit-test
 
     [ { "test1" "test2" } ] [
     ] unit-test
 
     [ { "test1" "test2" } ] [
@@ -688,13 +688,13 @@ select-me "select_me"
             dup data>> "test" = [ "test1" >>data ] [ drop f ] if
         ] update-tuples
         select-me new [ data>> ] collector [ each-tuple ] dip
             dup data>> "test" = [ "test1" >>data ] [ drop f ] if
         ] update-tuples
         select-me new [ data>> ] collector [ each-tuple ] dip
-        natural-sort
+        sort
     ] unit-test
 
     [ { "test2" } ] [
         select-me new [ data>> "test1" = ] reject-tuples
         select-me new [ data>> ] collector [ each-tuple ] dip
     ] unit-test
 
     [ { "test2" } ] [
         select-me new [ data>> "test1" = ] reject-tuples
         select-me new [ data>> ] collector [ each-tuple ] dip
-        natural-sort
+        sort
     ] unit-test ;
 
 [ test-mapping ] test-sqlite
     ] unit-test ;
 
 [ test-mapping ] test-sqlite
index e14ec104747e16112fa2a04b8727c8c77fe56e87..fa04fee4e53b69e35ca9c8cdf31a5c242e102334 100644 (file)
@@ -53,7 +53,7 @@ CONSTANT: highlighted-vocabs {
 
 : write-keywords ( vocab -- )
     lookup-vocab
 
 : write-keywords ( vocab -- )
     lookup-vocab
-    [ name>> ] [ vocab-words [ name>> ] map ] bi natural-sort [
+    [ name>> ] [ vocab-words [ name>> ] map ] bi sort [
         [ vocab-name>syntax-group-name
             [ "SynKeywordFactorWord " write write " | " write ] keep
         ] dip
         [ vocab-name>syntax-group-name
             [ "SynKeywordFactorWord " write write " | " write ] keep
         ] dip
index d595b1fead4f9fa55903425dd6d8ce672cb69a44..dadf2ab6a26bdcfa81018a355ad7029b7786ffcc 100644 (file)
@@ -35,7 +35,7 @@ IN: escape-strings
     [ length ] histogram-by
     dup keys length [0..b]
     [ [ of ] keep over [ 10^ < ] [ nip ] if ] with find nip
     [ length ] histogram-by
     dup keys length [0..b]
     [ [ of ] keep over [ 10^ < ] [ nip ] if ] with find nip
-    [ '[ length _ = ] filter natural-sort ] keep ! remove natural-sort here
+    [ '[ length _ = ] filter sort ] keep ! remove sort here
     [
         [ drop "" ] [
             10^ <iota> [
     [
         [ drop "" ] [
             10^ <iota> [
index 77a2019bb62fc5b0b37d9abd4defba9b6106a187..338add29fbe4c5180c27b075fcc7cdd5585b51f7 100644 (file)
@@ -7,6 +7,7 @@ IN: fixups
 CONSTANT: vocab-renames {
     { "math.intervals" { "intervals" "0.99" } }
     { "math.ranges" { "ranges" "0.99" } }
 CONSTANT: vocab-renames {
     { "math.intervals" { "intervals" "0.99" } }
     { "math.ranges" { "ranges" "0.99" } }
+    { "sorting.slots" { "sorting.specification" "0.99" } }
 }
 
 CONSTANT: word-renames {
 }
 
 CONSTANT: word-renames {
@@ -51,6 +52,13 @@ CONSTANT: word-renames {
     { "deep-subseq?" { "deep-subseq-of?" "0.99" } }
     { "overtomorrow" { "overmorrow" "0.99" } }
     { "INITIALIZE:" { "INITIALIZED-SYMBOL:" "0.99" } }
     { "deep-subseq?" { "deep-subseq-of?" "0.99" } }
     { "overtomorrow" { "overmorrow" "0.99" } }
     { "INITIALIZE:" { "INITIALIZED-SYMBOL:" "0.99" } }
+    { "natural-sort" { "sort" "0.99" } }
+    { "sort-by-with" { "sort-with-spec-by" "0.99" } }
+    { "sort-keys-by" { "sort-keys-with-spec" "0.99" } }
+    { "sort-values-by" { "sort-values-with-spec" "0.99" } }
+    { "compare-slots" { "compare-with-spec" "0.99" } }
+    { "natural-sort!" { "sort!" "0.99" } }
+    { "natural-bubble-sort!" { "bubble-sort!" "0.99" } }
 }
 
 : compute-assoc-fixups ( continuation name assoc -- seq )
 }
 
 : compute-assoc-fixups ( continuation name assoc -- seq )
index 0adc3b0290fa30c18e6c78d0feb6e170a4b2b462..686b1e50fef8d5ecc94744272f66851896355651 100644 (file)
@@ -77,17 +77,17 @@ tools.test ;
         "a/e/g" make-directory
         "a/e/g/e" touch-file
 
         "a/e/g" make-directory
         "a/e/g/e" touch-file
 
-        "**" glob natural-sort
-        "**/" glob natural-sort
-        "**/*" glob natural-sort
-        "**/**" glob natural-sort
-        "**/b" glob natural-sort
-        "**/e" glob natural-sort
-        ! "**//e" glob natural-sort
-        ! "**/**/e" glob natural-sort
-        "**/e/**" glob natural-sort
-        "a/**" glob natural-sort
-        "a" glob natural-sort
-        "a/b" glob natural-sort
+        "**" glob sort
+        "**/" glob sort
+        "**/*" glob sort
+        "**/**" glob sort
+        "**/b" glob sort
+        "**/e" glob sort
+        ! "**//e" glob sort
+        ! "**/**/e" glob sort
+        "**/e/**" glob sort
+        "a/**" glob sort
+        "a" glob sort
+        "a/b" glob sort
     ] with-test-directory
 ] unit-test
     ] with-test-directory
 ] unit-test
index 0107eab6e1d9da1be7a4e4d412e6de925c5c11bd..9b87817238b4a021a2c32a63496605eefcbdb100 100644 (file)
@@ -92,7 +92,7 @@ DEFER: (assert-heap-invariant)
     dup assert-heap-invariant
     data>>
     [ [ key>> ] map ] bi@
     dup assert-heap-invariant
     data>>
     [ [ key>> ] map ] bi@
-    [ natural-sort ] bi@ ;
+    [ sort ] bi@ ;
 
 11 [
     [ t ] swap [ 2^ delete-test sequence= ] curry unit-test
 
 11 [
     [ t ] swap [ 2^ delete-test sequence= ] curry unit-test
index 1efe70e6ff5645ee5c97984c78d2ebb56382a4f0..cd8ed38b8f3dd0fa97626077911208ea126953b3 100644 (file)
@@ -46,7 +46,7 @@ M: more-completions article-title
     ] "" make ;
 
 M: more-completions article-content
     ] "" make ;
 
 M: more-completions article-content
-    seq>> [ second >lower ] sort-with keys \ $completions prefix ;
+    seq>> [ second >lower ] sort-by keys \ $completions prefix ;
 
 :: (apropos) ( search completions category -- element )
     completions [
 
 :: (apropos) ( search completions category -- element )
     completions [
index 4f0f0256975229b39622dbc6e7b8477948eac503..87dd0ad20572780a3c180020fee21aa4d3d7d2a3 100644 (file)
@@ -41,7 +41,7 @@ MEMO: article-words ( name -- words )
         ] [
             first '[ article-words [ _ head? ] any? ] filter
         ] if
         ] [
             first '[ article-words [ _ head? ] any? ] filter
         ] if
-    ] if-empty [ article-name ] sort-with ;
+    ] if-empty [ article-name ] sort-by ;
 
 PRIVATE>
 
 
 PRIVATE>
 
index 500afffbdad5cfeae97055d535e52f7685dbc847..a4ade54c9dfb13fb40bf7e06530f4b25c65f9e43 100644 (file)
@@ -206,7 +206,7 @@ C: <vocab-author> vocab-author
     [
         "Words" $heading
 
     [
         "Words" $heading
 
-        natural-sort
+        sort
         [ [ class? ] filter describe-classes ]
         [
             [ [ class? ] [ symbol? ] bi and ] reject
         [ [ class? ] filter describe-classes ]
         [
             [ [ class? ] [ symbol? ] bi and ] reject
@@ -266,7 +266,7 @@ C: <vocab-author> vocab-author
 : keyed-vocabs ( str quot -- seq )
     [ all-disk-vocabs-recursive ] 2dip '[
         [ _ swap @ member? ] filter no-prefixes
 : keyed-vocabs ( str quot -- seq )
     [ all-disk-vocabs-recursive ] 2dip '[
         [ _ swap @ member? ] filter no-prefixes
-        [ name>> ] sort-with
+        [ name>> ] sort-by
     ] assoc-map ; inline
 
 : tagged ( tag -- assoc )
     ] assoc-map ; inline
 
 : tagged ( tag -- assoc )
index e83e6c4c61598b6472951a88afb951e4ae79e521..38ca7a3513b50de864f5828f6d6baffb13f8b41f 100644 (file)
@@ -114,26 +114,26 @@ TUPLE: file-responder root hook special index-names allow-listings ;
         [ ?toggle-sort-order ] 2bi append
     ] curry tri@ ;
 
         [ ?toggle-sort-order ] 2bi append
     ] curry tri@ ;
 
-: listing-sort-with ( seq quot: ( elt -- key ) -- sortedseq )
-    sort-with sort-asc? [ reverse ] unless ; inline
+: listing-sort-by ( seq quot: ( elt -- key ) -- sortedseq )
+    sort-by sort-asc? [ reverse ] unless ; inline
 
 
-: sort-with-name ( {file,info} -- sorted )
-    [ first ] listing-sort-with ;
+: sort-by-name ( {file,info} -- sorted )
+    [ first ] listing-sort-by ;
 
 
-: sort-with-modified ( {file,info} -- sorted )
-    [ second modified>> ] listing-sort-with ;
+: sort-by-modified ( {file,info} -- sorted )
+    [ second modified>> ] listing-sort-by ;
 
 : size-without-directories ( info -- size )
     dup directory? [ drop -1 ] [ size>> ] if ;
 
 
 : size-without-directories ( info -- size )
     dup directory? [ drop -1 ] [ size>> ] if ;
 
-: sort-with-size ( {file,info} -- sorted )
-    [ second size-without-directories ] listing-sort-with ;
+: sort-by-size ( {file,info} -- sorted )
+    [ second size-without-directories ] listing-sort-by ;
 
 : sort-listing ( zipped-files-infos -- sorted )
     sort-column {
 
 : sort-listing ( zipped-files-infos -- sorted )
     sort-column {
-        { "M" [ sort-with-modified ] }
-        { "S" [ sort-with-size ] }
-        [ drop sort-with-name ]
+        { "M" [ sort-by-modified ] }
+        { "S" [ sort-by-size ] }
+        [ drop sort-by-name ]
     } case ; inline
 
 : zip-files-infos ( files -- zipped )
     } case ; inline
 
 : zip-files-infos ( files -- zipped )
index 839751195603d86c0686d94b1329320a86c87f83..79ff552aab4eddcb85530a1322bc101a2863ff2e 100644 (file)
@@ -45,7 +45,7 @@ PRIVATE>
     interval-map check-instance array>> [ third-unsafe ] map ;
 
 : <interval-map> ( specification -- map )
     interval-map check-instance array>> [ third-unsafe ] map ;
 
 : <interval-map> ( specification -- map )
-    all-intervals [ first-unsafe second-unsafe ] sort-with
+    all-intervals [ first-unsafe second-unsafe ] sort-by
     >intervals ensure-disjoint interval-map boa ;
 
 : <interval-set> ( specification -- map )
     >intervals ensure-disjoint interval-map boa ;
 
 : <interval-set> ( specification -- map )
index 2f2d95ff13fb7761413a37c355116da8e8ffd30e..92d7e52d8da48edb016476d9055ce01587000338 100644 (file)
@@ -179,7 +179,7 @@ tools.test ;
 { t } [
     [
         10 [ "io.paths.test" "gogogo" unique-file ] replicate
 { t } [
     [
         10 [ "io.paths.test" "gogogo" unique-file ] replicate
-        "." [ ] find-files [ absolute-path ] map [ natural-sort ] same?
+        "." [ ] find-files [ absolute-path ] map [ sort ] same?
     ] with-test-directory
 ] unit-test
 
     ] with-test-directory
 ] unit-test
 
@@ -279,8 +279,8 @@ tools.test ;
 
             ! preserve file traversal order, but sort
             ! alphabetically for cross-platform testing
 
             ! preserve file traversal order, but sort
             ! alphabetically for cross-platform testing
-            dup length 3 / group natural-sort
-            [ natural-sort ] map concat
+            dup length 3 / group sort
+            [ sort ] map concat
         ] with-variable
 
         +breadth-first+ traversal-method [
         ] with-variable
 
         +breadth-first+ traversal-method [
@@ -290,7 +290,7 @@ tools.test ;
             ! preserve file traversal order, but sort
             ! alphabetically for cross-platform testing
             [ [ length ] bi@ = ] monotonic-split
             ! preserve file traversal order, but sort
             ! alphabetically for cross-platform testing
             [ [ length ] bi@ = ] monotonic-split
-            [ natural-sort ] map concat
+            [ sort ] map concat
         ] with-variable
     ] with-test-directory
 ] unit-test
         ] with-variable
     ] with-test-directory
 ] unit-test
index e492cbe5000ce6b0db226c2c5ad34037efd6e94f..20a485e46fc10ab79c43db098676ea84e407f000 100644 (file)
@@ -24,7 +24,7 @@ IN: math.primes.factors
     ] [
         group-factors dup empty? [
             [ first2 [0..b] [ ^ ] with map ] map
     ] [
         group-factors dup empty? [
             [ first2 [0..b] [ ^ ] with map ] map
-            [ product ] product-map natural-sort
+            [ product ] product-map sort
         ] unless
     ] if ;
 
         ] unless
     ] if ;
 
index 8e434e352d3d623e5ebea9c8724dfaff8a6caf4a..6ec9f81528538c756babc809c3fc49a85c09ea6f 100644 (file)
@@ -70,4 +70,4 @@ DEFER: pollard-rho-brent-factors
         ] [
             [ (pollard-rho-brent-factors) ] { } make
         ] if
         ] [
             [ (pollard-rho-brent-factors) ] { } make
         ] if
-    ] if natural-sort ;
+    ] if sort ;
index 82dfa36ff4009f0f30e641a43dc48f29ad22a96d..68856813f460f89c6169b84db93169a6b7a58b6a 100644 (file)
@@ -83,10 +83,10 @@ M: ranges:range sum-of-quads
 PRIVATE>
 
 : trimmed-mean ( seq p -- x )
 PRIVATE>
 
 : trimmed-mean ( seq p -- x )
-    swap natural-sort trim-points <slice> mean ;
+    swap sort trim-points <slice> mean ;
 
 : winsorized-mean ( seq p -- x )
 
 : winsorized-mean ( seq p -- x )
-    swap natural-sort trim-points
+    swap sort trim-points
     [ <slice> ]
     [ nip dupd nth <array> ]
     [ [ 1 - ] dip nth <array> ] 3tri
     [ <slice> ]
     [ nip dupd nth <array> ]
     [ [ 1 - ] dip nth <array> ] 3tri
@@ -420,6 +420,6 @@ PRIVATE>
         dup dcg [
             drop 0.0
         ] [
         dup dcg [
             drop 0.0
         ] [
-            swap natural-sort <reversed> dcg /f
+            swap sort <reversed> dcg /f
         ] if-zero
     ] if-empty ;
         ] if-zero
     ] if-empty ;
index 956fd27ad56a4c0f08f48679fcc7a7018986159b..bb36e6da2b4c02df2c7c466bd0fd6ba4b268077a 100644 (file)
@@ -55,7 +55,7 @@ CONSTANT: upload3 "--3f116598c7f0431b9f98148ed235c822\r\nContent-Disposition: fo
     { "text" "text2" }
 } [
     upload3 [ separator3 parse-multipart ] with-string-reader
     { "text" "text2" }
 } [
     upload3 [ separator3 parse-multipart ] with-string-reader
-    keys natural-sort
+    keys sort
 ] unit-test
 
 SYMBOL: mime-test-server
 ] unit-test
 
 SYMBOL: mime-test-server
index e9daeb1c313ccb26469334e53ca36e215eb6b21b..576fc5024c9712de55755f04584b222948df084c 100644 (file)
@@ -4,4 +4,4 @@ USING: models.arrow.smart sorting ;
 IN: models.sort
 
 : <sort> ( values sort -- model )
 IN: models.sort
 
 : <sort> ( values sort -- model )
-    [ '[ _ call( obj1 obj2 -- <=> ) ] sort ] <smart-arrow> ; inline
+    [ '[ _ call( obj1 obj2 -- <=> ) ] sort-with ] <smart-arrow> ; inline
index 8029d9d175230276fcafe4f3a4ea81a983462bf4..689e15701d26bf8e74cd21c0395d0fdeb6ae3427 100644 (file)
@@ -23,7 +23,7 @@ IN: regexp.minimize
 
 :: initialize-partitions ( transition-table -- partitions )
     ! Partition table is sorted-array => ?
 
 :: initialize-partitions ( transition-table -- partitions )
     ! Partition table is sorted-array => ?
-    transition-table transitions>> keys natural-sort :> states
+    transition-table transitions>> keys sort :> states
     states length 2/ sq <hash-set> :> out
     states [| s1 i1 |
         states [| s2 |
     states length 2/ sq <hash-set> :> out
     states [| s1 i1 |
         states [| s2 |
@@ -47,7 +47,7 @@ IN: regexp.minimize
     ] each partitions dup cardinality size = not ;
 
 : partition>classes ( partitions -- synonyms ) ! old-state => new-state
     ] each partitions dup cardinality size = not ;
 
 : partition>classes ( partitions -- synonyms ) ! old-state => new-state
-    members natural-sort <reversed> [ swap ] H{ } assoc-map-as ;
+    members inv-sort [ swap ] H{ } assoc-map-as ;
 
 : (state-classes) ( transition-table -- partition )
     [ initialize-partitions ] keep '[ _ partition-more ] loop ;
 
 : (state-classes) ( transition-table -- partition )
     [ initialize-partitions ] keep '[ _ partition-more ] loop ;
index b6ecf57032a0498a5da16b2ac4abcfdf7d6cbe74..df14c4249c077a55e243199ca0471de91dd18e3e 100644 (file)
@@ -255,15 +255,15 @@ M: error-class see* see-class ;
     dup implementors
     [ [ reader? ] [ writer? ] bi or ] reject
     [ lookup-method ] with map
     dup implementors
     [ [ reader? ] [ writer? ] bi or ] reject
     [ lookup-method ] with map
-    natural-sort ;
+    sort ;
 
 : seeing-methods ( generic -- seq )
 
 : seeing-methods ( generic -- seq )
-    "methods" word-prop values natural-sort ;
+    "methods" word-prop values sort ;
 
 PRIVATE>
 
 : see-all ( seq -- )
 
 PRIVATE>
 
 : see-all ( seq -- )
-    natural-sort [ nl nl ] [ see* ] interleave ;
+    sort [ nl nl ] [ see* ] interleave ;
 
 : methods ( word -- seq )
     [
 
 : methods ( word -- seq )
     [
index f7ed06c164480547208979aeb60627a33911c85c..2dc1659f7b0656853f41aea8e0fc845ee2a5153d 100644 (file)
@@ -2,7 +2,7 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors circular combinators.short-circuit io kernel
 math math.order sequences sequences.parser sequences.private
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors circular combinators.short-circuit io kernel
 math math.order sequences sequences.parser sequences.private
-sorting.functor sorting.slots unicode ;
+sorting unicode ;
 IN: sequences.parser
 
 TUPLE: sequence-parser sequence n ;
 IN: sequences.parser
 
 TUPLE: sequence-parser sequence n ;
@@ -132,10 +132,7 @@ TUPLE: sequence-parser sequence n ;
         sequence-parser [ n + ] change-n drop
     ] if ;
 
         sequence-parser [ n + ] change-n drop
     ] if ;
 
-<< "length" [ length ] define-sorting >>
-
-: sort-tokens ( seq -- seq' )
-    { length>=< <=> } sort-by ;
+: sort-tokens ( seq -- seq' ) [ length ] inv-sort-by ;
 
 : take-first-matching ( sequence-parser seq -- seq )
     swap
 
 : take-first-matching ( sequence-parser seq -- seq )
     swap
index c19346579adefdb37bd5187c37b0738ad42affa6..feebd1242e7ce283c05390627d11fe16746c2487 100644 (file)
@@ -1,20 +1,20 @@
-USING: sorting.human tools.test sorting.slots sorting ;
+USING: sorting.human tools.test sorting ;
 
 { { "x1y" "x2" "x10y" } }
 
 { { "x1y" "x2" "x10y" } }
-[ { "x1y" "x10y" "x2" } { human<=> } sort-by ] unit-test
+[ { "x1y" "x10y" "x2" } [ human<=> ] sort-with ] unit-test
 
 { { "4dup" "nip" } }
 
 { { "4dup" "nip" } }
-[ { "4dup" "nip" } [ human<=> ] sort ] unit-test
+[ { "4dup" "nip" } [ human<=> ] sort-with ] unit-test
 
 { { "4dup" "nip" } }
 
 { { "4dup" "nip" } }
-[ { "nip" "4dup" } [ human<=> ] sort ] unit-test
+[ { "nip" "4dup" } [ human<=> ] sort-with ] unit-test
 
 { { "4dup" "4nip" "5drop" "nip" "nip2" "nipd" } }
 
 { { "4dup" "4nip" "5drop" "nip" "nip2" "nipd" } }
-[ { "nip" "4dup" "4nip" "5drop" "nip2" "nipd" } [ human<=> ] sort ] unit-test
+[ { "nip" "4dup" "4nip" "5drop" "nip2" "nipd" } [ human<=> ] sort-with ] unit-test
 
 
 { { "Abc" "abc" "def" "gh" } }
 
 
 { { "Abc" "abc" "def" "gh" } }
-[ { "abc" "Abc" "def" "gh" } [ human<=> ] sort ] unit-test
+[ { "abc" "Abc" "def" "gh" } [ human<=> ] sort-with ] unit-test
 
 { { "abc" "Abc" "def" "gh" } }
 
 { { "abc" "Abc" "def" "gh" } }
-[ { "abc" "Abc" "def" "gh" } [ humani<=> ] sort ] unit-test
+[ { "abc" "Abc" "def" "gh" } [ humani<=> ] sort-with ] unit-test
index 103d0048a4478d929af3ed4bc7316e239920c0d7..dbb4decb96878b07f7fd5b6a7b26abf6e6263dea 100644 (file)
@@ -49,5 +49,5 @@ M: alphanum <=>
 << "human" [ find-numbers [ <alphanum> ] map ] define-sorting >>
 << "humani" [ find-numbers [ <alphanum-insensitive> ] map ] define-sorting >>
 
 << "human" [ find-numbers [ <alphanum> ] map ] define-sorting >>
 << "humani" [ find-numbers [ <alphanum-insensitive> ] map ] define-sorting >>
 
-: human-sort ( seq -- seq' ) [ human<=> ] sort ;
-: humani-sort ( seq -- seq' ) [ humani<=> ] sort ;
+: human-sort ( seq -- seq' ) [ human<=> ] sort-with ;
+: humani-sort ( seq -- seq' ) [ humani<=> ] sort-with ;
diff --git a/basis/sorting/slots/authors.txt b/basis/sorting/slots/authors.txt
deleted file mode 100644 (file)
index 5674120..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Doug Coleman
-Slava Pestov
diff --git a/basis/sorting/slots/slots-docs.factor b/basis/sorting/slots/slots-docs.factor
deleted file mode 100644 (file)
index 178805e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-! Copyright (C) 2009 Doug Coleman.
-! See https://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax kernel quotations math.order
-sequences ;
-IN: sorting.slots
-
-HELP: compare-slots
-{ $values
-  { "obj1" object }
-  { "obj2" object }
-  { "sort-specs" "a sequence of accessors ending with a comparator" }
-  { "<=>" { $link +lt+ } " " { $link +eq+ } " or " { $link +gt+ } }
-}
-{ $description "Compares two objects using a chain of intrinsic linear orders such that if two objects are " { $link +eq+ } ", then the next comparator is tried. The comparators are slot-name/comparator pairs." } ;
-
-HELP: sort-by
-{ $values
-    { "seq" sequence } { "sort-specs" "a sequence of accessors ending with a comparator" }
-    { "seq'" sequence }
-}
-{ $description "Sorts a sequence of tuples by the sort-specs in " { $snippet "sort-spec" } ". A sort-spec is a sequence of slot accessors ending in a comparator." }
-{ $examples
-    "Sort by slot a, then b descending:"
-    { $example
-        "USING: accessors math.order prettyprint sorting.slots ;"
-        "IN: scratchpad"
-        "TUPLE: sort-me a b ;"
-        "{"
-        "    T{ sort-me f 2 3 } T{ sort-me f 3 2 }"
-        "    T{ sort-me f 4 3 } T{ sort-me f 2 1 }"
-        "}"
-        "{ { a>> <=> } { b>> >=< } } sort-by ."
-        "{\n    T{ sort-me { a 2 } { b 3 } }\n    T{ sort-me { a 2 } { b 1 } }\n    T{ sort-me { a 3 } { b 2 } }\n    T{ sort-me { a 4 } { b 3 } }\n}"
-    }
-} ;
-
-ARTICLE: "sorting.slots" "Sorting by slots"
-"The " { $vocab-link "sorting.slots" } " vocabulary can sort tuples by slot in ascending or descending order, using subsequent slots as tie-breakers." $nl
-"Comparing two objects by a sequence of slots:"
-{ $subsections compare-slots }
-"Sorting a sequence of tuples by a slot/comparator pairs:"
-{ $subsections
-    sort-by
-    sort-keys-by
-    sort-values-by
-} ;
-
-ABOUT: "sorting.slots"
diff --git a/basis/sorting/slots/slots-tests.factor b/basis/sorting/slots/slots-tests.factor
deleted file mode 100644 (file)
index 4772a4d..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-! Copyright (C) 2009 Doug Coleman.
-! See https://factorcode.org/license.txt for BSD license.
-USING: accessors math.order sorting.slots tools.test
-arrays sequences kernel assocs multiline sorting.functor ;
-IN: sorting.literals.tests
-
-TUPLE: sort-test a b c tuple2 ;
-
-TUPLE: tuple2 d ;
-
-{
-    {
-        T{ sort-test { a 1 } { b 3 } { c 9 } }
-        T{ sort-test { a 1 } { b 1 } { c 10 } }
-        T{ sort-test { a 1 } { b 1 } { c 11 } }
-        T{ sort-test { a 2 } { b 5 } { c 2 } }
-        T{ sort-test { a 2 } { b 5 } { c 3 } }
-    }
-} [
-    {
-        T{ sort-test f 1 3 9 }
-        T{ sort-test f 1 1 10 }
-        T{ sort-test f 1 1 11 }
-        T{ sort-test f 2 5 3 }
-        T{ sort-test f 2 5 2 }
-    } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-by
-] unit-test
-
-{
-    {
-        T{ sort-test { a 1 } { b 3 } { c 9 } }
-        T{ sort-test { a 1 } { b 1 } { c 10 } }
-        T{ sort-test { a 1 } { b 1 } { c 11 } }
-        T{ sort-test { a 2 } { b 5 } { c 2 } }
-        T{ sort-test { a 2 } { b 5 } { c 3 } }
-    }
-} [
-    {
-        T{ sort-test f 1 3 9 }
-        T{ sort-test f 1 1 10 }
-        T{ sort-test f 1 1 11 }
-        T{ sort-test f 2 5 3 }
-        T{ sort-test f 2 5 2 }
-    } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-by
-] unit-test
-
-{ { } }
-[ { } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-by ] unit-test
-
-{ { } }
-[ { } { } sort-by ] unit-test
-
-{
-    {
-        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 1 } } } }
-        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 2 } } } }
-        T{ sort-test { a 5 } { tuple2 T{ tuple2 { d 3 } } } }
-        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 3 } } } }
-        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 3 } } } }
-        T{ sort-test { a 5 } { tuple2 T{ tuple2 { d 4 } } } }
-    }
-} [
-    {
-        T{ sort-test f 6 f f T{ tuple2 f 1 } }
-        T{ sort-test f 5 f f T{ tuple2 f 4 } }
-        T{ sort-test f 6 f f T{ tuple2 f 3 } }
-        T{ sort-test f 6 f f T{ tuple2 f 3 } }
-        T{ sort-test f 5 f f T{ tuple2 f 3 } }
-        T{ sort-test f 6 f f T{ tuple2 f 2 } }
-    } { { tuple2>> d>> <=> } { a>> <=> } } sort-by
-] unit-test
-
-
-{ { "a" "b" "c" } } [ { "b" "c" "a" } { <=> <=> } sort-by ] unit-test
-{ { "b" "c" "a" } } [ { "b" "c" "a" } { } sort-by ] unit-test
-
-<< "length-test" [ length ] define-sorting >>
-
-{ { { 1 } { 1 2 3 } { 1 3 2 } { 3 2 1 } } }
-[
-    { { 3 2 1 } { 1 2 3 } { 1 3 2 } { 1 } }
-    { length-test<=> <=> } sort-by
-] unit-test
-
-{ { { { 0 } 1 } { { 1 } 2 } { { 1 } 1 } { { 3 1 } 2 } } }
-[
-    { { { 3 1 } 2 } { { 1 } 2 } { { 0 } 1 } { { 1 } 1 } }
-    { length-test<=> <=> } sort-keys-by
-] unit-test
-
-{ { { 0 { 1 } } { 1 { 1 } } { 3 { 2 4 } } { 1 { 2 0 0 0 } } } }
-[
-    { { 3 { 2 4 } } { 1 { 2 0 0 0 } } { 0 { 1 } } { 1 { 1 } } }
-    { length-test<=> <=> } sort-values-by
-] unit-test
-
-{ { { "apples" 1 } { "bananas" 2 } { "cherries" 3 } } } [
-    H{ { "apples" 1 } { "bananas" 2 } { "cherries" 3 } }
-    { { sequences:length <=> } } sort-keys-by
-] unit-test
diff --git a/basis/sorting/slots/slots.factor b/basis/sorting/slots/slots.factor
deleted file mode 100644 (file)
index 66c3874..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-! Copyright (C) 2009 Slava Pestov, Doug Coleman.
-! See https://factorcode.org/license.txt for BSD license.
-USING: arrays assocs fry kernel math.order sequences sorting ;
-IN: sorting.slots
-
-: execute-comparator ( obj1 obj2 word -- <=>/f )
-    execute( obj1 obj2 -- <=> ) dup +eq+ eq? [ drop f ] when ;
-
-: execute-accessor ( obj1 obj2 word -- obj1' obj2' )
-    '[ _ execute( tuple -- value ) ] bi@ ;
-
-: compare-slots ( obj1 obj2 sort-specs -- <=> )
-    ! sort-spec: { accessors comparator }
-    [
-        dup array? [
-            unclip-last-slice
-            [ [ execute-accessor ] each ] dip
-        ] when execute-comparator
-    ] 2with map-find drop +eq+ or ;
-
-: sort-by-with ( seq sort-specs quot: ( obj -- key ) -- seq' )
-    swap '[ _ bi@ _ compare-slots ] sort ; inline
-
-: sort-by ( seq sort-specs -- seq' ) [ ] sort-by-with ;
-
-: sort-keys-by ( alist sort-seq -- seq' )
-    [ >alist ] dip [ first ] sort-by-with ;
-
-: sort-values-by ( seq sort-seq -- seq' )
-    [ >alist ] dip [ second ] sort-by-with ;
diff --git a/basis/sorting/slots/summary.txt b/basis/sorting/slots/summary.txt
deleted file mode 100644 (file)
index 240a4ff..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sorting by tuple slots
diff --git a/basis/sorting/specification/authors.txt b/basis/sorting/specification/authors.txt
new file mode 100644 (file)
index 0000000..5674120
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Slava Pestov
diff --git a/basis/sorting/specification/specification-docs.factor b/basis/sorting/specification/specification-docs.factor
new file mode 100644 (file)
index 0000000..fb87d26
--- /dev/null
@@ -0,0 +1,48 @@
+! Copyright (C) 2009 Doug Coleman.
+! See https://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations math.order
+sequences ;
+IN: sorting.specification
+
+HELP: compare-with-spec
+{ $values
+  { "obj1" object }
+  { "obj2" object }
+  { "sort-spec" "a sequence of sequences of accessors and a comparator" }
+  { "<=>" { $link +lt+ } ", " { $link +eq+ } " or " { $link +gt+ } }
+}
+{ $description "Compares two objects using a chain of intrinsic linear orders such that if two objects are " { $link +eq+ } ", then the next ordering is tried." } ;
+
+HELP: sort-with-spec
+{ $values
+    { "seq" sequence } { "sort-spec" "a sequence of sequences of accessors and a comparator" }
+    { "seq'" sequence }
+}
+{ $description "Sorts a sequence of objects by the sorting specification in " { $snippet "sort-spec" } ". A sorting specification is a sequence of sequences, each consisting of accessors and a comparator." }
+{ $examples
+    "Sort by slot a, then b descending:"
+    { $example
+        "USING: accessors math.order prettyprint sorting.specification ;"
+        "IN: scratchpad"
+        "TUPLE: sort-me a b ;"
+        "{"
+        "    T{ sort-me f 2 3 } T{ sort-me f 3 2 }"
+        "    T{ sort-me f 4 3 } T{ sort-me f 2 1 }"
+        "}"
+        "{ { a>> <=> } { b>> >=< } } sort-with-spec ."
+        "{\n    T{ sort-me { a 2 } { b 3 } }\n    T{ sort-me { a 2 } { b 1 } }\n    T{ sort-me { a 3 } { b 2 } }\n    T{ sort-me { a 4 } { b 3 } }\n}"
+    }
+} ;
+
+ARTICLE: "sorting.specification" "Sorting by multiple keys"
+"The " { $vocab-link "sorting.specification" } " vocabulary can sort objects by multiple keys in ascending or descending order, using subsequent keys as tie-breakers." $nl
+"Comparing two objects with a sorting specification:"
+{ $subsections compare-with-spec }
+"Sorting a sequence of objects with a sorting specification:"
+{ $subsections
+    sort-with-spec
+    sort-keys-with-spec
+    sort-values-with-spec
+} ;
+
+ABOUT: "sorting.specification"
diff --git a/basis/sorting/specification/specification-tests.factor b/basis/sorting/specification/specification-tests.factor
new file mode 100644 (file)
index 0000000..05fdbb8
--- /dev/null
@@ -0,0 +1,100 @@
+! Copyright (C) 2009 Doug Coleman.
+! See https://factorcode.org/license.txt for BSD license.
+USING: accessors math.order sorting.specification tools.test
+arrays sequences kernel assocs multiline sorting.functor ;
+IN: sorting.specification.tests
+
+TUPLE: sort-test a b c tuple2 ;
+
+TUPLE: tuple2 d ;
+
+{
+    {
+        T{ sort-test { a 1 } { b 3 } { c 9 } }
+        T{ sort-test { a 1 } { b 1 } { c 10 } }
+        T{ sort-test { a 1 } { b 1 } { c 11 } }
+        T{ sort-test { a 2 } { b 5 } { c 2 } }
+        T{ sort-test { a 2 } { b 5 } { c 3 } }
+    }
+} [
+    {
+        T{ sort-test f 1 3 9 }
+        T{ sort-test f 1 1 10 }
+        T{ sort-test f 1 1 11 }
+        T{ sort-test f 2 5 3 }
+        T{ sort-test f 2 5 2 }
+    } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-with-spec
+] unit-test
+
+{
+    {
+        T{ sort-test { a 1 } { b 3 } { c 9 } }
+        T{ sort-test { a 1 } { b 1 } { c 10 } }
+        T{ sort-test { a 1 } { b 1 } { c 11 } }
+        T{ sort-test { a 2 } { b 5 } { c 2 } }
+        T{ sort-test { a 2 } { b 5 } { c 3 } }
+    }
+} [
+    {
+        T{ sort-test f 1 3 9 }
+        T{ sort-test f 1 1 10 }
+        T{ sort-test f 1 1 11 }
+        T{ sort-test f 2 5 3 }
+        T{ sort-test f 2 5 2 }
+    } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-with-spec
+] unit-test
+
+{ { } } [
+    { } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-with-spec
+] unit-test
+
+{ { } } [ { } { } sort-with-spec ] unit-test
+
+{
+    {
+        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 1 } } } }
+        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 2 } } } }
+        T{ sort-test { a 5 } { tuple2 T{ tuple2 { d 3 } } } }
+        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 3 } } } }
+        T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 3 } } } }
+        T{ sort-test { a 5 } { tuple2 T{ tuple2 { d 4 } } } }
+    }
+} [
+    {
+        T{ sort-test f 6 f f T{ tuple2 f 1 } }
+        T{ sort-test f 5 f f T{ tuple2 f 4 } }
+        T{ sort-test f 6 f f T{ tuple2 f 3 } }
+        T{ sort-test f 6 f f T{ tuple2 f 3 } }
+        T{ sort-test f 5 f f T{ tuple2 f 3 } }
+        T{ sort-test f 6 f f T{ tuple2 f 2 } }
+    } { { tuple2>> d>> <=> } { a>> <=> } } sort-with-spec
+] unit-test
+
+
+{ { "a" "b" "c" } } [ { "b" "c" "a" } { <=> <=> } sort-with-spec ] unit-test
+{ { "b" "c" "a" } } [ { "b" "c" "a" } { } sort-with-spec ] unit-test
+
+<< "length-test" [ length ] define-sorting >>
+
+{ { { 1 } { 1 2 3 } { 1 3 2 } { 3 2 1 } } }
+[
+    { { 3 2 1 } { 1 2 3 } { 1 3 2 } { 1 } }
+    { length-test<=> <=> } sort-with-spec
+] unit-test
+
+{ { { { 0 } 1 } { { 1 } 2 } { { 1 } 1 } { { 3 1 } 2 } } }
+[
+    { { { 3 1 } 2 } { { 1 } 2 } { { 0 } 1 } { { 1 } 1 } }
+    { length-test<=> <=> } sort-keys-with-spec
+] unit-test
+
+{ { { 0 { 1 } } { 1 { 1 } } { 3 { 2 4 } } { 1 { 2 0 0 0 } } } }
+[
+    { { 3 { 2 4 } } { 1 { 2 0 0 0 } } { 0 { 1 } } { 1 { 1 } } }
+    { length-test<=> <=> } sort-values-with-spec
+] unit-test
+
+{ { { "apples" 1 } { "bananas" 2 } { "cherries" 3 } } } [
+    H{ { "apples" 1 } { "bananas" 2 } { "cherries" 3 } }
+    { { sequences:length <=> } } sort-keys-with-spec
+] unit-test
diff --git a/basis/sorting/specification/specification.factor b/basis/sorting/specification/specification.factor
new file mode 100644 (file)
index 0000000..6132da3
--- /dev/null
@@ -0,0 +1,30 @@
+! Copyright (C) 2009 Slava Pestov, Doug Coleman.
+! See https://factorcode.org/license.txt for BSD license.
+USING: arrays assocs kernel math.order sequences sorting ;
+IN: sorting.specification
+
+: execute-comparator ( obj1 obj2 word -- <=>/f )
+    execute( obj1 obj2 -- <=> ) dup +eq+ eq? [ drop f ] when ;
+
+: execute-accessor ( obj1 obj2 word -- obj1' obj2' )
+    '[ _ execute( tuple -- value ) ] bi@ ;
+
+: compare-with-spec ( obj1 obj2 sort-spec -- <=> )
+    ! sort-spec: { { accessor ... comparator } ... }
+    [
+        dup array? [
+            unclip-last-slice
+            [ [ execute-accessor ] each ] dip
+        ] when execute-comparator
+    ] 2with map-find drop +eq+ or ;
+
+: sort-with-spec-by ( seq sort-spec quot: ( obj -- key ) -- sortedseq )
+    swap '[ _ bi@ _ compare-with-spec ] sort-with ; inline
+
+: sort-with-spec ( seq sort-spec -- seq' ) [ ] sort-with-spec-by ;
+
+: sort-keys-with-spec ( assoc sort-spec -- alist )
+    [ >alist ] dip [ first ] sort-with-spec-by ;
+
+: sort-values-with-spec ( assoc sort-spec -- alist )
+    [ >alist ] dip [ second ] sort-with-spec-by ;
diff --git a/basis/sorting/specification/summary.txt b/basis/sorting/specification/summary.txt
new file mode 100644 (file)
index 0000000..81dd16e
--- /dev/null
@@ -0,0 +1 @@
+Sorting by multiple keys
index 03d806a4c9818f32ee7fe6e06ad61082babcd7c4..790fb13935c8aaebbdfba8ab6e2a4ce53691ff9b 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See https://factorcode.org/license.txt for BSD license.
 ! Copyright (C) 2009 Doug Coleman.
 ! See https://factorcode.org/license.txt for BSD license.
-USING: tools.test sorting.title sorting.slots ;
+USING: tools.test sorting sorting.title ;
 IN: sorting.title.tests
 
 : sort-me ( -- seq )
 IN: sorting.title.tests
 
 : sort-me ( -- seq )
@@ -42,5 +42,5 @@ IN: sorting.title.tests
         "la vida loca"
     }
 } [
         "la vida loca"
     }
 } [
-    sort-me { title<=> } sort-by
+    sort-me [ title<=> ] sort-with
 ] unit-test
 ] unit-test
index e1a7a72ed2128142b5b66e3f1fbcc602870bef72..030dd3ecc3f7740d4652079c5f91da25d7f4fb93 100644 (file)
@@ -53,7 +53,7 @@ TUPLE: upward-slice < slice ;
         drop
         [ downward-slices ]
         [ stable-slices ]
         drop
         [ downward-slices ]
         [ stable-slices ]
-        [ upward-slices ] tri 3append [ from>> ] sort-with
+        [ upward-slices ] tri 3append [ from>> ] sort-by
     ] [
         zero? [ drop { } ] [ [ 0 1 ] dip stable-slice boa ] if
     ] if ;
     ] [
         zero? [ drop { } ] [ [ 0 1 ] dip stable-slice boa ] if
     ] if ;
index 9b8f1bfaf724b699f4cbc9316be56b349cba89dc..fec9dffef9f864a4b947f5ec2f740ea00397a458 100644 (file)
@@ -30,7 +30,7 @@ IN: suffix-arrays
 PRIVATE>
 
 : >suffix-array ( seq -- suffix-array )
 PRIVATE>
 
 : >suffix-array ( seq -- suffix-array )
-    members [ suffixes ] map concat natural-sort ;
+    members [ suffixes ] map concat sort ;
 
 SYNTAX: SA{ \ } [ >suffix-array ] parse-literal ;
 
 
 SYNTAX: SA{ \ } [ >suffix-array ] parse-literal ;
 
index 7de102651eb3e95d6468bb319bfc484aa0906868..64d6cca431ee2ff137c885eb7e20ddc5810c670e 100644 (file)
@@ -148,6 +148,6 @@ PRIVATE>
 
 : word-timing. ( -- )
     word-timing get >alist
 
 : word-timing. ( -- )
     word-timing get >alist
-    [ second first ] sort-with
+    [ second first ] sort-by
     [ first2 first2 [ 1,000,000,000 /f ] dip 3array ] map
     simple-table. ;
     [ first2 first2 [ 1,000,000,000 /f ] dip 3array ] map
     simple-table. ;
index f61fa71f90440bcb87e514093f9e8220769aed21..e386c98653dcc3f66b5368904a44b6e5e052937a 100644 (file)
@@ -11,7 +11,7 @@ tools.test vocabs.loader ;
 {
   { halftested mconcat testcond testfry testif testifprivate testmacro untested
 }
 {
   { halftested mconcat testcond testfry testif testifprivate testmacro untested
 }
-} [ "tools.coverage.testvocab" [ ] map-words natural-sort ] unit-test
+} [ "tools.coverage.testvocab" [ ] map-words sort ] unit-test
 
 { t } [
   "tools.coverage.testvocab"
 
 { t } [
   "tools.coverage.testvocab"
@@ -21,7 +21,7 @@ tools.test vocabs.loader ;
 
 {
   { testifprivate }
 
 {
   { testifprivate }
-} [ "tools.coverage.testvocab.private" [ ] map-words natural-sort ] unit-test
+} [ "tools.coverage.testvocab.private" [ ] map-words sort ] unit-test
 
 { t } [
   "tools.coverage.testvocab.private"
 
 { t } [
   "tools.coverage.testvocab.private"
@@ -44,7 +44,7 @@ tools.test vocabs.loader ;
     { testmacro { } }
     { untested { [ ] } }
   }
     { testmacro { } }
     { untested { [ ] } }
   }
-} [ "tools.coverage.testvocab" [ reload ] [ test-coverage natural-sort ] bi ] unit-test
+} [ "tools.coverage.testvocab" [ reload ] [ test-coverage sort ] bi ] unit-test
 
 { 0.75 } [ "tools.coverage.testvocab.child" [ reload ] [ %coverage ] bi ] unit-test
 
 
 { 0.75 } [ "tools.coverage.testvocab.child" [ reload ] [ %coverage ] bi ] unit-test
 
@@ -70,6 +70,6 @@ tools.test vocabs.loader ;
 }
 } [
   "tools.coverage.testvocab.child" reload
 }
 } [
   "tools.coverage.testvocab.child" reload
-  "tools.coverage.testvocab" [ reload ] [ test-coverage-recursively ] bi natural-sort
-  [ first2 natural-sort 2array ] map
+  "tools.coverage.testvocab" [ reload ] [ test-coverage-recursively ] bi sort
+  [ first2 sort 2array ] map
 ] unit-test
 ] unit-test
index 9fbcb13f49195c9da6f61cc982c291bc3ba38136..3b91dfa18ef03f9d896750fe80df62346857d0dc 100644 (file)
@@ -124,7 +124,7 @@ M: f smart-usage drop \ f smart-usage ;
             [ "method-generic" word-prop ] when
             vocabulary>>
         ] map
             [ "method-generic" word-prop ] when
             vocabulary>>
         ] map
-    ] gather natural-sort remove sift ; inline
+    ] gather sort remove sift ; inline
 
 : vocabs. ( seq -- )
     [ dup >vocab-link write-object nl ] each ;
 
 : vocabs. ( seq -- )
     [ dup >vocab-link write-object nl ] each ;
index 9d82549fea28442eab7ea26ead23e622b5ad0874..ea723e73d2984e7bdfee29c4cacf265f13ed2bcf 100644 (file)
@@ -11,7 +11,7 @@ IN: tools.destructors
     members [ class-of ] collect-by ;
 
 : (disposables.) ( set -- )
     members [ class-of ] collect-by ;
 
 : (disposables.) ( set -- )
-    class-tally >alist [ first2 [ length ] keep 3array ] map [ second ] sort-with
+    class-tally >alist [ first2 [ length ] keep 3array ] map [ second ] sort-by
     standard-table-style [
         [
             [ "Disposable class" write ] with-cell
     standard-table-style [
         [
             [ "Disposable class" write ] with-cell
@@ -31,7 +31,7 @@ IN: tools.destructors
     ] tabular-output nl ;
 
 : sort-disposables ( seq -- seq' )
     ] tabular-output nl ;
 
 : sort-disposables ( seq -- seq' )
-    [ disposable? ] partition [ [ id>> ] sort-with ] dip append ;
+    [ disposable? ] partition [ [ id>> ] sort-by ] dip append ;
 
 PRIVATE>
 
 
 PRIVATE>
 
index 4b4ffb97718b218c304ec244e01c46922f6ce936..4ad3ba90bc1d428fc22725b7ea2df6b6168d309a 100644 (file)
@@ -2,8 +2,8 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays calendar calendar.english
 calendar.format combinators io.directories io.files.info kernel
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays calendar calendar.english
 calendar.format combinators io.directories io.files.info kernel
-math math.parser prettyprint sequences sorting.slots splitting
-system vocabs ;
+math math.parser prettyprint sequences sorting.specification
+splitting system vocabs ;
 IN: tools.files
 
 <PRIVATE
 IN: tools.files
 
 <PRIVATE
@@ -76,7 +76,7 @@ M: object file-spec>string
 : list-files-slow ( listing-tool -- array )
     [ path>> ] [ sort>> ] [ specs>> ] tri '[
         [ dup name>> link-info file-listing boa ] map
 : list-files-slow ( listing-tool -- array )
     [ path>> ] [ sort>> ] [ specs>> ] tri '[
         [ dup name>> link-info file-listing boa ] map
-        _ [ sort-by ] when*
+        _ [ sort-with-spec ] when*
         [ _ [ file-spec>string ] with map ] map
     ] with-directory-entries ; inline
 
         [ _ [ file-spec>string ] with map ] map
     ] with-directory-entries ; inline
 
index 5678354a73a479ce1077abb3c49d353b840fc56a..23b919d3068ca60d1f7c77a823ea4a220b3b983e 100644 (file)
@@ -87,7 +87,7 @@ PRIVATE>
     [ '[ _ _ heap-stat-step ] each ] 2keep ;
 
 : heap-stats. ( -- )
     [ '[ _ _ heap-stat-step ] each ] 2keep ;
 
 : heap-stats. ( -- )
-    heap-stats dup keys natural-sort standard-table-style [
+    heap-stats dup keys sort standard-table-style [
         [ { "Class" "Bytes" "Instances" } [ write-cell ] each ] with-row
         [
             [
         [ { "Class" "Bytes" "Instances" } [ write-cell ] each ] with-row
         [
             [
index cae79e6cc6f62e3bb4e6ff7bc4c7ffe991da3a82..c9aac35a54f7cf3de99ab03988cd54fa501728b4 100644 (file)
@@ -201,7 +201,7 @@ PRIVATE>
     H{ } [ "  " <repetition> concat ] cache write ;
 
 : by-total-time ( nodes -- nodes' )
     H{ } [ "  " <repetition> concat ] cache write ;
 
 : by-total-time ( nodes -- nodes' )
-    >alist [ second total-time>> ] inv-sort-with ;
+    >alist [ second total-time>> ] inv-sort-by ;
 
 : duration. ( duration -- )
     1000 * "%9.1f" printf ;
 
 : duration. ( duration -- )
     1000 * "%9.1f" printf ;
index 104b62965bf4d536423884c55a476c2ce8d77391..606927dee4d1960cf5086bbaf305ee00ad8a994e 100644 (file)
@@ -219,7 +219,7 @@ M: object add-using
 : interesting-words ( vocab -- array )
     vocab-words
     [ { [ "help" word-prop ] [ predicate? ] } 1|| ] reject
 : interesting-words ( vocab -- array )
     vocab-words
     [ { [ "help" word-prop ] [ predicate? ] } 1|| ] reject
-    natural-sort ;
+    sort ;
 
 : interesting-words. ( vocab -- )
     interesting-words [ (help.) nl ] each ;
 
 : interesting-words. ( vocab -- )
     interesting-words [ (help.) nl ] each ;
@@ -241,7 +241,7 @@ M: object add-using
 : write-using ( vocab -- )
     "USING:" write
     using get members
 : write-using ( vocab -- )
     "USING:" write
     using get members
-    { "help.markup" "help.syntax" } append natural-sort remove
+    { "help.markup" "help.syntax" } append sort remove
     [ bl write ] each
     " ;" print ;
 
     [ bl write ] each
     " ;" print ;
 
index 00b1c3cecac6b6e4d8aa8438529ee3c05504ae72..20170a6b7a292b132d0dbab8fbc75dcb850c07bf 100644 (file)
@@ -17,7 +17,7 @@ IN: ui.gadgets.grid-lines.tests
     1array
     <grid>
     { 100 100 } >>dim
     1array
     <grid>
     { 100 100 } >>dim
-    compute-grid-lines natural-sort
+    compute-grid-lines sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -33,7 +33,7 @@ IN: ui.gadgets.grid-lines.tests
     <grid>
     { 10 10 } >>gap
     dup prefer
     <grid>
     { 10 10 } >>gap
     dup prefer
-    compute-grid-lines natural-sort
+    compute-grid-lines sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -51,7 +51,7 @@ IN: ui.gadgets.grid-lines.tests
     2array
     <grid>
     { 200.0 200 } >>dim
     2array
     <grid>
     { 200.0 200 } >>dim
-    compute-grid-lines natural-sort
+    compute-grid-lines sort
 ] unit-test
 
 {
 ] unit-test
 
 {
index 5c82c6c5016ca4c0dba4a51721b6881dafc3e069..baa4a21d2a21b3e798c160118639fcda53f4da0a 100644 (file)
@@ -155,7 +155,7 @@ menu H{
 : <operations-menu> ( target hook -- menu )
     over object-operations
     [ primary-operation? ] partition
 : <operations-menu> ( target hook -- menu )
     over object-operations
     [ primary-operation? ] partition
-    [ reverse ] [ [ command-name ] sort-with ] bi*
+    [ reverse ] [ [ command-name ] sort-by ] bi*
     { ---- } glue <commands-menu> ;
 
 : show-operations-menu ( gadget target hook -- )
     { ---- } glue <commands-menu> ;
 
 : show-operations-menu ( gadget target hook -- )
index b185e7d6cbfe1b59f6a753cfd7d03c19484cf00c..2c8c84d19e1e59352d6eda5fe8d87fbae52c4fdf 100644 (file)
@@ -91,7 +91,7 @@ M: string make-slot-descriptions
     ] { } map-index-as ;
 
 M: hashtable make-slot-descriptions
     ] { } map-index-as ;
 
 M: hashtable make-slot-descriptions
-    call-next-method [ key-string>> ] sort-with ;
+    call-next-method [ key-string>> ] sort-by ;
 
 TUPLE: inspector-table < table ;
 
 
 TUPLE: inspector-table < table ;
 
index 9988f9606eca29b0d424de3262a467a175834905..cad7d0f2e0954becf6e1f6ca7dd574739f52ef72 100644 (file)
@@ -212,7 +212,7 @@ PRIVATE>
     0 insensitive= ;
 
 : sort-strings ( strings -- sorted )
     0 insensitive= ;
 
 : sort-strings ( strings -- sorted )
-    [ collation-key/nfd 2array ] map natural-sort values ;
+    [ collation-key/nfd 2array ] map sort values ;
 
 : string<=> ( str1 str2 -- <=> )
     [ collation-key/nfd 2array ] compare ;
 
 : string<=> ( str1 str2 -- <=> )
     [ collation-key/nfd 2array ] compare ;
index 576ce1c1640eb7ecd7528d11d4e2a6fc427ebcb1..dc7512d9f63655d49042216778beea6497e55674 100644 (file)
@@ -2,8 +2,8 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays combinators combinators.smart
 io.encodings.utf8 io.files kernel math math.order math.parser
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays combinators combinators.smart
 io.encodings.utf8 io.files kernel math math.order math.parser
-memoize sequences sorting.slots splitting splitting.monotonic
-strings io.pathnames calendar words ;
+memoize sequences sorting.specification splitting
+splitting.monotonic strings io.pathnames calendar words ;
 IN: unix.linux.proc
 
 ! /proc/*
 IN: unix.linux.proc
 
 ! /proc/*
@@ -110,7 +110,7 @@ ERROR: unknown-cpuinfo-line string ;
     { "" } split harvest [ lines>processor-info ] map ;
 
 : sort-cpus ( seq -- seq )
     { "" } split harvest [ lines>processor-info ] map ;
 
 : sort-cpus ( seq -- seq )
-    { { physical-id>> <=> } { core-id>> <=> } } sort-by
+    { { physical-id>> <=> } { core-id>> <=> } } sort-with-spec
     [ [ physical-id>> ] bi@ = ] monotonic-split
     [ [ [ core-id>> ] bi@ = ] monotonic-split ] map ;
 
     [ [ physical-id>> ] bi@ = ] monotonic-split
     [ [ [ core-id>> ] bi@ = ] monotonic-split ] map ;
 
index 407e270825acbf6ae1103faa1896a72a7f89e42d..0d50928854cec5545e5ee967eaf0535794f5e59e 100644 (file)
@@ -18,7 +18,7 @@ M: vocab-prefix vocab-name name>> ;
     { [ directory? ] [ name>> "." head? not ] } 1&& ;
 
 : visible-dirs ( seq -- seq' )
     { [ directory? ] [ name>> "." head? not ] } 1&& ;
 
 : visible-dirs ( seq -- seq' )
-    [ visible-dir? ] filter [ name>> ] sort-with ;
+    [ visible-dir? ] filter [ name>> ] sort-by ;
 
 ERROR: vocab-root-required root ;
 
 
 ERROR: vocab-root-required root ;
 
@@ -106,7 +106,7 @@ MEMO: all-disk-vocabs-recursive ( -- assoc )
 
 : collect-vocabs ( quot -- seq )
     [ all-disk-vocabs-recursive filter-vocabs ] dip
 
 : collect-vocabs ( quot -- seq )
     [ all-disk-vocabs-recursive filter-vocabs ] dip
-    gather natural-sort ; inline
+    gather sort ; inline
 
 : maybe-include-root/prefix ( root prefix -- vocab-link/f )
     over [
 
 : maybe-include-root/prefix ( root prefix -- vocab-link/f )
     over [
index 79700eb1b38082703d00c0d0d36f550a7cd16905..94fc5d97d4607641c7caedeead13b03f7e463895 100644 (file)
@@ -21,10 +21,10 @@ IN: vocabs.metadata.resources.tests
 
 ! vocab-resource-files
 { { "bar" "bas" "foo" } }
 
 ! vocab-resource-files
 { { "bar" "bas" "foo" } }
-[ "vocabs.metadata.resources.test.1" vocab-resource-files natural-sort ] unit-test
+[ "vocabs.metadata.resources.test.1" vocab-resource-files sort ] unit-test
 
 { { "bar.wtf" "foo.wtf" } }
 
 { { "bar.wtf" "foo.wtf" } }
-[ "vocabs.metadata.resources.test.2" vocab-resource-files natural-sort ] unit-test
+[ "vocabs.metadata.resources.test.2" vocab-resource-files sort ] unit-test
 
 {
     {
 
 {
     {
@@ -36,5 +36,5 @@ IN: vocabs.metadata.resources.tests
         "resource-dir/foo"
     }
 } [
         "resource-dir/foo"
     }
 } [
-    "vocabs.metadata.resources.test.3" vocab-resource-files natural-sort
+    "vocabs.metadata.resources.test.3" vocab-resource-files sort
 ] unit-test
 ] unit-test
index f92a4b1bac25dd0746dd1ae1aed4a6fcb0099dfd..890ab2a8ef7e92f4f22bff2a66f244f0bca0e1f5 100644 (file)
@@ -14,8 +14,7 @@ IN: vocabs.prettyprint
 
 <PRIVATE
 
 
 <PRIVATE
 
-: sort-vocabs ( seq -- seq' )
-    [ vocab-name ] sort-with ;
+: sort-vocabs ( seq -- seq' ) [ vocab-name ] sort-by ;
 
 : pprint-using ( seq -- )
     "syntax" lookup-vocab '[ _ = ] reject
 
 : pprint-using ( seq -- )
     "syntax" lookup-vocab '[ _ = ] reject
index e1f70d6a94f3054e83d470bbac3cf5b18c453654..d59e128d6fcde4cbcc28c6dde26bd1c6beaa00df 100644 (file)
@@ -30,7 +30,7 @@ MEMO: modes ( -- modes )
     file>xml parse-modes-tag ;
 
 MEMO: mode-names ( -- modes )
     file>xml parse-modes-tag ;
 
 MEMO: mode-names ( -- modes )
-    modes keys natural-sort ;
+    modes keys sort ;
 
 : reset-catalog ( -- )
     \ modes reset-memoized ;
 
 : reset-catalog ( -- )
     \ modes reset-memoized ;
index 7a9bdfb0bc728b823dd5e1aa95fb47cf4c2a92a3..83842d8d8a132c0488245c05f9b6562ba4ff5b0c 100644 (file)
@@ -31,7 +31,7 @@ M: keyword-map >alist
     assoc>> >alist ;
 
 : (keyword-map-no-word-sep) ( assoc -- str )
     assoc>> >alist ;
 
 : (keyword-map-no-word-sep) ( assoc -- str )
-    keys union-all [ alpha? ] reject natural-sort ;
+    keys union-all [ alpha? ] reject sort ;
 
 : keyword-map-no-word-sep* ( keyword-map -- str )
     dup no-word-sep>> [ ] [
 
 : keyword-map-no-word-sep* ( keyword-map -- str )
     dup no-word-sep>> [ ] [
index d9a905771555602c323bb304b57bb61c7513e768..81bd5ea331a82d67ed323f3aced1a1fa55ad59f1 100644 (file)
@@ -270,15 +270,14 @@ ERROR: topological-sort-failed ;
     [ topological-sort-failed ] unless* ;
 
 : sort-classes ( seq -- newseq )
     [ topological-sort-failed ] unless* ;
 
 : sort-classes ( seq -- newseq )
-    [ class-name ] sort-with >vector
+    [ class-name ] sort-by >vector
     [ dup empty? not ]
     [ dup largest-class [ swap remove-nth! ] dip ]
     produce nip ;
 
 : smallest-class ( classes -- class/f )
     [ f ] [
     [ dup empty? not ]
     [ dup largest-class [ swap remove-nth! ] dip ]
     produce nip ;
 
 : smallest-class ( classes -- class/f )
     [ f ] [
-        natural-sort <reversed>
-        [ ] [ [ class<= ] most ] map-reduce
+        inv-sort [ ] [ [ class<= ] most ] map-reduce
     ] if-empty ;
 
 : flatten-class ( class -- seq )
     ] if-empty ;
 
 : flatten-class ( class -- seq )
index ff2798030bf60d1d4f752236a7b6a3faad5c0aaf..b61ff7b8076e28e88f5dae21997864d72f3ca6f0 100644 (file)
@@ -21,7 +21,7 @@ M: method-forget-class method-forget-test ;
 { { } { } } [
     all-words [ class? ] filter
     implementors-map get keys
 { { } { } } [
     all-words [ class? ] filter
     implementors-map get keys
-    [ natural-sort ] bi@
+    [ sort ] bi@
     [ diff ] [ swap diff ] 2bi
 ] unit-test
 
     [ diff ] [ swap diff ] 2bi
 ] unit-test
 
index 4a69a371c9a7771a0c2a36b3560fafec8bf075aa..0c096ace8f00aefde35c76d7e4cee2433d723cab 100644 (file)
@@ -16,7 +16,7 @@ H{
 } "g" set
 
 { { 2 3 4 5 } } [
 } "g" set
 
 { { 2 3 4 5 } } [
-    2 [ "g" get at sets:members ] closure sets:members natural-sort
+    2 [ "g" get at sets:members ] closure sets:members sort
 ] unit-test
 
 { t } [ 2 [ "g" get at sets:members ] HS{ } closure-as hash-set? ] unit-test
 ] unit-test
 
 { t } [ 2 [ "g" get at sets:members ] HS{ } closure-as hash-set? ] unit-test
index 34adcaddfacf739c014b03bc4a4cb65de98403ae..90e4f4ac59468dd562b290a4afe9d63727e02238 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors hash-sets kernel math prettyprint sequences
 sets sorting tools.test ;
 
 USING: accessors hash-sets kernel math prettyprint sequences
 sets sorting tools.test ;
 
-{ { 1 2 3 } } [ HS{ 1 2 3 } members natural-sort ] unit-test
+{ { 1 2 3 } } [ HS{ 1 2 3 } members sort ] unit-test
 
 { "HS{ 1 2 3 4 }" } [ HS{ 1 2 3 4 } unparse ] unit-test
 
 
 { "HS{ 1 2 3 4 }" } [ HS{ 1 2 3 4 } unparse ] unit-test
 
@@ -18,7 +18,7 @@ sets sorting tools.test ;
 { t } [ 1 HS{ 1 } ?delete ] unit-test
 { f } [ 1 HS{ } ?delete ] unit-test
 { HS{ 1 2 } } [ HS{ 1 2 } fast-set ] unit-test
 { t } [ 1 HS{ 1 } ?delete ] unit-test
 { f } [ 1 HS{ } ?delete ] unit-test
 { HS{ 1 2 } } [ HS{ 1 2 } fast-set ] unit-test
-{ { 1 2 } } [ HS{ 1 2 } members natural-sort ] unit-test
+{ { 1 2 } } [ HS{ 1 2 } members sort ] unit-test
 
 { HS{ 1 2 3 4 } } [ HS{ 1 2 3 } HS{ 2 3 4 } union ] unit-test
 { HS{ 2 3 } } [ HS{ 1 2 3 } HS{ 2 3 4 } intersect ] unit-test
 
 { HS{ 1 2 3 4 } } [ HS{ 1 2 3 } HS{ 2 3 4 } union ] unit-test
 { HS{ 2 3 } } [ HS{ 1 2 3 } HS{ 2 3 4 } intersect ] unit-test
index f612c74da5774347dd1217b51e52bafb2bae023b..4d27f8c8e0e519e3f92892c9381c622286e151c6 100644 (file)
@@ -23,8 +23,8 @@ IN: sets.tests
 { 0 } [ 5 <bit-set> 10 over delete cardinality ] unit-test
 { HS{ 1 } } [ HS{ 1 2 } 2 over delete ] unit-test
 
 { 0 } [ 5 <bit-set> 10 over delete cardinality ] unit-test
 { HS{ 1 } } [ HS{ 1 2 } 2 over delete ] unit-test
 
-{ { 1 2 3 } } [ { 1 1 1 2 2 3 3 3 3 3 } dup set-like natural-sort ] unit-test
-{ { 1 2 3 } } [ HS{ 1 2 3 } { } set-like natural-sort ] unit-test
+{ { 1 2 3 } } [ { 1 1 1 2 2 3 3 3 3 3 } dup set-like sort ] unit-test
+{ { 1 2 3 } } [ HS{ 1 2 3 } { } set-like sort ] unit-test
 { { 1 2 3 } } [ { 1 2 2 3 3 } { } set-like ] unit-test
 { { 3 2 1 } } [ { 3 3 2 2 1 } { } set-like ] unit-test
 { t } [ 4 <bit-set> 1 <bit-set> set-like 4 <bit-set> = ] unit-test
 { { 1 2 3 } } [ { 1 2 2 3 3 } { } set-like ] unit-test
 { { 3 2 1 } } [ { 3 3 2 2 1 } { } set-like ] unit-test
 { t } [ 4 <bit-set> 1 <bit-set> set-like 4 <bit-set> = ] unit-test
index ce284c5938749993ba0180a799291f434a23e7fd..bc3d7286f30fa7fec3bc674b95983a46761f036d 100644 (file)
@@ -7,31 +7,32 @@ ARTICLE: "sequences-sorting" "Sorting sequences"
 $nl
 "The algorithm only allocates two additional arrays, both the size of the input sequence, and uses iteration rather than recursion, and thus is suitable for sorting large sequences."
 $nl
 $nl
 "The algorithm only allocates two additional arrays, both the size of the input sequence, and uses iteration rather than recursion, and thus is suitable for sorting large sequences."
 $nl
-"Sorting combinators all take comparator quotations with stack effect " { $snippet "( elt1 elt2 -- <=> )" } ", where the output value is one of the three " { $link "order-specifiers" } "."
+"Sorting combinators take comparator quotations with stack effect " { $snippet "( elt1 elt2 -- <=> )" } ", where the output value is one of the three " { $link "order-specifiers" } "."
 $nl
 "Sorting a sequence with a custom comparator:"
 $nl
 "Sorting a sequence with a custom comparator:"
-{ $subsections sort }
+{ $subsections sort-with }
 "Sorting a sequence with common comparators:"
 { $subsections
 "Sorting a sequence with common comparators:"
 { $subsections
-    sort-with
-    inv-sort-with
-    natural-sort
+    sort
+    inv-sort
+    sort-by
+    inv-sort-by
     sort-keys
     sort-values
 } ;
 
 ABOUT: "sequences-sorting"
 
     sort-keys
     sort-values
 } ;
 
 ABOUT: "sequences-sorting"
 
-HELP: sort
+HELP: sort-with
 { $values { "seq" sequence } { "quot" { $quotation ( obj1 obj2 -- <=> ) } } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "seq" } " into a new array using a stable sort." }
 { $notes "The algorithm used is the merge sort." } ;
 
 { $values { "seq" sequence } { "quot" { $quotation ( obj1 obj2 -- <=> ) } } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "seq" } " into a new array using a stable sort." }
 { $notes "The algorithm used is the merge sort." } ;
 
-HELP: sort-with
+HELP: sort-by
 { $values { "seq" sequence } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "seq" } " by applying " { $link compare } " with " { $snippet "quot" } " to each pair of elements in the sequence." } ;
 
 { $values { "seq" sequence } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "seq" } " by applying " { $link compare } " with " { $snippet "quot" } " to each pair of elements in the sequence." } ;
 
-HELP: inv-sort-with
+HELP: inv-sort-by
 { $values { "seq" sequence } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "seq" } " by applying " { $link compare } " with " { $snippet "quot" } " to each pair of elements in the sequence and inverting the results." } ;
 
 { $values { "seq" sequence } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "seq" } " by applying " { $link compare } " with " { $snippet "quot" } " to each pair of elements in the sequence and inverting the results." } ;
 
@@ -43,7 +44,7 @@ HELP: sort-values
 { $values { "obj" object } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "obj" } " (converting to an alist first if not a sequence), comparing second elements of pairs using the " { $link <=> } " word." } ;
 
 { $values { "obj" object } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts the elements of " { $snippet "obj" } " (converting to an alist first if not a sequence), comparing second elements of pairs using the " { $link <=> } " word." } ;
 
-HELP: natural-sort
+HELP: sort
 { $values { "seq" sequence } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts a sequence of objects in natural order using the " { $link <=> } " word." } ;
 
 { $values { "seq" sequence } { "sortedseq" "a new sorted sequence" } }
 { $description "Sorts a sequence of objects in natural order using the " { $link <=> } " word." } ;
 
@@ -51,8 +52,4 @@ HELP: sort-pair
 { $values { "a" object } { "b" object } { "c" object } { "d" object } }
 { $description "If " { $snippet "a" } " is greater than " { $snippet "b" } ", exchanges " { $snippet "a" } " with " { $snippet "b" } "." } ;
 
 { $values { "a" object } { "b" object } { "c" object } { "d" object } }
 { $description "If " { $snippet "a" } " is greater than " { $snippet "b" } ", exchanges " { $snippet "a" } " with " { $snippet "b" } "." } ;
 
-HELP: midpoint@
-{ $values { "seq" sequence } { "n" integer } }
-{ $description "Outputs the index of the midpoint of " { $snippet "seq" } "." } ;
-
-{ <=> compare natural-sort sort-with inv-sort-with sort-keys sort-values } related-words
+{ <=> compare sort sort-by inv-sort-by sort-keys sort-values } related-words
index 3f84bd4abc679965760e57b3525d650128361b59..359007f1294f5e9300b10aac8c2d99018f677311 100644 (file)
@@ -1,22 +1,22 @@
 USING: grouping kernel math math.order random sequences sets
 sorting tools.test vocabs ;
 
 USING: grouping kernel math math.order random sequences sets
 sorting tools.test vocabs ;
 
-{ { } } [ { } natural-sort ] unit-test
+{ { } } [ { } sort ] unit-test
 
 { { 270000000 270000001 } }
 
 { { 270000000 270000001 } }
-[ T{ slice f 270000000 270000002 T{ iota f 270000002 } } natural-sort ]
+[ T{ slice f 270000000 270000002 T{ iota f 270000002 } } sort ]
 unit-test
 
 { t } [
     100 [
         drop
         100 [ 20 random [ 1000 random ] replicate ] replicate
 unit-test
 
 { t } [
     100 [
         drop
         100 [ 20 random [ 1000 random ] replicate ] replicate
-        dup natural-sort
+        dup sort
         [ set= ] [ nip [ before=? ] monotonic? ] 2bi and
     ] all-integers?
 ] unit-test
 
         [ set= ] [ nip [ before=? ] monotonic? ] 2bi and
     ] all-integers?
 ] unit-test
 
-[ { 1 2 } [ 2drop 1 ] sort ] must-not-fail
+[ { 1 2 } [ 2drop 1 ] sort-with ] must-not-fail
 
 ! Is it a stable sort?
 { t } [ { { 1 "a" } { 1 "b" } { 1 "c" } } dup sort-keys = ] unit-test
 
 ! Is it a stable sort?
 { t } [ { { 1 "a" } { 1 "b" } { 1 "c" } } dup sort-keys = ] unit-test
@@ -24,4 +24,4 @@ unit-test
 { { { 1 "a" } { 1 "b" } { 1 "c" } { 1 "e" } { 2 "d" } } }
 [ { { 1 "a" } { 1 "b" } { 1 "c" } { 2 "d" } { 1 "e" } } sort-keys ] unit-test
 
 { { { 1 "a" } { 1 "b" } { 1 "c" } { 1 "e" } { 2 "d" } } }
 [ { { 1 "a" } { 1 "b" } { 1 "c" } { 2 "d" } { 1 "e" } } sort-keys ] unit-test
 
-[ all-words natural-sort ] must-not-fail
+[ all-words sort ] must-not-fail
index f2e50daef2c8cfc382e2c05ef1672faf1a88031b..1867f4321d92b37dd7daadaade7ae255c37736e5 100644 (file)
@@ -131,17 +131,22 @@ TUPLE: merge-state
 
 PRIVATE>
 
 
 PRIVATE>
 
-: sort ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
+: sort-with ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
     [ <merge> ] dip
     [ sort-pairs ] [ sort-loop ] [ drop accum>> underlying>> ] 2tri ; inline
 
     [ <merge> ] dip
     [ sort-pairs ] [ sort-loop ] [ drop accum>> underlying>> ] 2tri ; inline
 
-: natural-sort ( seq -- sortedseq ) [ <=> ] sort ;
+: inv-sort-with ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
+    '[ @ invert-comparison ] sort-with ; inline
 
 
-: sort-with ( seq quot: ( elt -- key ) -- sortedseq )
-    [ compare ] curry sort ; inline
+: sort ( seq -- sortedseq ) [ <=> ] sort-with ;
 
 
-: inv-sort-with ( seq quot: ( elt -- key ) -- sortedseq )
-    [ compare invert-comparison ] curry sort ; inline
+: inv-sort ( seq -- sortedseq ) [ >=< ] sort-with ;
+
+: sort-by ( seq quot: ( elt -- key ) -- sortedseq )
+    [ compare ] curry sort-with ; inline
+
+: inv-sort-by ( seq quot: ( elt -- key ) -- sortedseq )
+    [ compare invert-comparison ] curry sort-with ; inline
 
 <PRIVATE
 
 
 <PRIVATE
 
@@ -150,24 +155,44 @@ PRIVATE>
 
 PRIVATE>
 
 
 PRIVATE>
 
-GENERIC: sort-keys ( obj -- sortedseq )
+GENERIC: sort-keys ( assoc -- sorted-keys )
 
 M: object sort-keys >alist sort-keys ;
 
 M: sequence sort-keys
 
 M: object sort-keys >alist sort-keys ;
 
 M: sequence sort-keys
-    0 check-bounds [ first-unsafe ] sort-with ;
+    0 check-bounds [ first-unsafe ] sort-by ;
 
 M: hashtable sort-keys
 
 M: hashtable sort-keys
-    >alist [ { array } declare first-unsafe ] sort-with ;
+    >alist [ { array } declare first-unsafe ] sort-by ;
+
+GENERIC: inv-sort-keys ( assoc -- sorted-keys )
+
+M: object inv-sort-keys >alist inv-sort-keys ;
+
+M: sequence inv-sort-keys
+    0 check-bounds [ first-unsafe ] inv-sort-by ;
 
 
-GENERIC: sort-values ( obj -- sortedseq )
+M: hashtable inv-sort-keys
+    >alist [ { array } declare first-unsafe ] inv-sort-by ;
+
+GENERIC: sort-values ( assoc -- sorted-values )
 
 M: object sort-values >alist sort-values ;
 
 M: sequence sort-values
 
 M: object sort-values >alist sort-values ;
 
 M: sequence sort-values
-    1 check-bounds [ second-unsafe ] sort-with ;
+    1 check-bounds [ second-unsafe ] sort-by ;
 
 M: hashtable sort-values
 
 M: hashtable sort-values
-    >alist [ { array } declare second-unsafe ] sort-with ;
+    >alist [ { array } declare second-unsafe ] sort-by ;
 
 : sort-pair ( a b -- c d ) 2dup after? [ swap ] when ;
 
 : sort-pair ( a b -- c d ) 2dup after? [ swap ] when ;
+
+GENERIC: inv-sort-values ( assoc -- sorted-values )
+
+M: object inv-sort-values >alist inv-sort-values ;
+
+M: sequence inv-sort-values
+    1 check-bounds [ second-unsafe ] inv-sort-by ;
+
+M: hashtable inv-sort-values
+    >alist [ { array } declare second-unsafe ] inv-sort-by ;
index 8445b0f299b516fa56ebde8b4565247e7382fa29..3abdfe3c9ae8821ef883b0716b421ec7ea760be7 100644 (file)
@@ -27,7 +27,7 @@ M: source-file-error compute-restarts error>> compute-restarts ;
         swap >>error ; inline
 
 : sort-errors ( errors -- alist )
         swap >>error ; inline
 
 : sort-errors ( errors -- alist )
-    [ [ line#>> 0 or ] sort-with ] { } assoc-map-as sort-keys ;
+    [ [ line#>> 0 or ] sort-by ] { } assoc-map-as sort-keys ;
 
 : group-by-source-file ( errors -- assoc )
     [ path>> ] collect-by ;
 
 : group-by-source-file ( errors -- assoc )
     [ path>> ] collect-by ;
index 86de9d5fabf3bd1b4b5ea2088e908b65b3eeee35..43137631d999b5f70b49ac66aa32f2305ac0329b 100644 (file)
@@ -10,7 +10,7 @@ IN: vocabs.parser
 ERROR: no-word-error name ;
 
 : word-restarts ( possibilities -- restarts )
 ERROR: no-word-error name ;
 
 : word-restarts ( possibilities -- restarts )
-    natural-sort [
+    sort [
         [ vocabulary>> "Use the " " vocabulary" surround ] keep
     ] { } map>assoc ;
 
         [ vocabulary>> "Use the " " vocabulary" surround ] keep
     ] { } map>assoc ;
 
index a778ff4235e50849818e3b15d5831035005a6be7..b56374f86882f63898c0377aacdaedd5fb48cc5c 100644 (file)
@@ -99,7 +99,7 @@ GENERIC: vocab-changed ( vocab obj -- )
 ERROR: no-vocab name ;
 
 : loaded-vocab-names ( -- seq )
 ERROR: no-vocab name ;
 
 : loaded-vocab-names ( -- seq )
-    dictionary get keys natural-sort ;
+    dictionary get keys sort ;
 
 : vocab-words ( vocab-spec -- seq )
     vocab-words-assoc values ;
 
 : vocab-words ( vocab-spec -- seq )
     vocab-words-assoc values ;
index d28475bbb4aa0fa582f9db6756590850595705e9..c7dc34665d618322788ff6a02e6fcb413e2089dd 100644 (file)
@@ -357,7 +357,7 @@ M: character-type (<fortran-result>)
     ] bi* ;
 
 : (fortran-in-shuffle) ( ret par -- seq )
     ] bi* ;
 
 : (fortran-in-shuffle) ( ret par -- seq )
-    [ second ] sort-with append ;
+    [ second ] sort-by append ;
 
 : (fortran-out-shuffle) ( ret par -- seq )
     append ;
 
 : (fortran-out-shuffle) ( ret par -- seq )
     append ;
index b68f428a7b85f3b6f3e6b010f2e8fa4e75830047..023b361885b8bc5f029d7f2a062e75490b1a4596 100644 (file)
@@ -6,7 +6,7 @@ sequences sequences.extras sorting sets ;
 IN: anagrams
 
 : make-anagram-hash ( strings -- assoc )
 IN: anagrams
 
 : make-anagram-hash ( strings -- assoc )
-    [ natural-sort ] collect-by
+    [ sort ] collect-by
     [ members ] assoc-map
     [ nip length 1 > ] assoc-filter ;
 
     [ members ] assoc-map
     [ nip length 1 > ] assoc-filter ;
 
@@ -17,7 +17,7 @@ MEMO: dict-anagrams ( -- assoc )
     dict-words make-anagram-hash ;
 
 : anagrams ( str -- seq/f )
     dict-words make-anagram-hash ;
 
 : anagrams ( str -- seq/f )
-    >lower natural-sort dict-anagrams at ;
+    >lower sort dict-anagrams at ;
 
 : most-anagrams ( -- seq )
     dict-anagrams values all-longest ;
 
 : most-anagrams ( -- seq )
     dict-anagrams values all-longest ;
index eee45528a3b8c703d0bec13b4b395a10cb7d6be0..1af0c2bdb483fee08e65593e13dcde89eafc4511 100644 (file)
@@ -47,7 +47,7 @@ PRIVATE>
 {
     "The " { $vocab-link "annotations" } " vocabulary provides syntax for comment-like annotations that can be looked up with Factor's " { $link usage } " mechanism."
 }
 {
     "The " { $vocab-link "annotations" } " vocabulary provides syntax for comment-like annotations that can be looked up with Factor's " { $link usage } " mechanism."
 }
-annotation-tags natural-sort
+annotation-tags sort
 [
     [ \ $subsection swap comment-word 2array ] map append
     "To look up annotations:" suffix
 [
     [ \ $subsection swap comment-word 2array ] map append
     "To look up annotations:" suffix
index 0b2b12e811d05ba14e6162d3deb01a28c403363b..693bb6c38fe97e6919c904b5d0e57cfcfbcb20ba 100644 (file)
@@ -7,7 +7,7 @@ sorting ;
 IN: benchmark.interval-sets
 
 : interval-sets-benchmark ( -- )
 IN: benchmark.interval-sets
 
 : interval-sets-benchmark ( -- )
-    10,000 [ random-32 ] replicate natural-sort
+    10,000 [ random-32 ] replicate sort
     2 <groups> <interval-set>
     3,000,000 swap '[ random-32 _ interval-in? drop ] times ;
 
     2 <groups> <interval-set>
     3,000,000 swap '[ random-32 _ interval-in? drop ] times ;
 
index 70744c13de72f4a53b014a8a08ab7b3c0988fea7..9221f0ec28e44427d0a3b0ee3e221a6c535729f0 100644 (file)
@@ -5,7 +5,7 @@ CONSTANT: numbers-to-sort $[ 300,000 200 random-integers ]
 CONSTANT: alist-to-sort $[ 1,000 <iota> dup zip ]
 
 : sort-benchmark ( -- )
 CONSTANT: alist-to-sort $[ 1,000 <iota> dup zip ]
 
 : sort-benchmark ( -- )
-    10 [ numbers-to-sort natural-sort drop ] times
+    10 [ numbers-to-sort sort drop ] times
     5,000 [ alist-to-sort sort-keys drop ] times ;
 
 MAIN: sort-benchmark
     5,000 [ alist-to-sort sort-keys drop ] times ;
 
 MAIN: sort-benchmark
index 1872fb2facf0c675dfa1a2905a5c5993b58b19f2..ce074a7febabd8609f8a26b3500de1a5cb048fe0 100644 (file)
@@ -15,6 +15,6 @@ IN: benchmark.splay
 : splay-benchmark ( -- )
     100,000 initial-alist 10,000 cut
     [ >splay ] [ randomize 10,000 head ] bi
 : splay-benchmark ( -- )
     100,000 initial-alist 10,000 cut
     [ >splay ] [ randomize 10,000 head ] bi
-    change-random keys dup natural-sort assert= ;
+    change-random keys dup sort assert= ;
 
 MAIN: splay-benchmark
 
 MAIN: splay-benchmark
index 52df5c49a549090461aa9c30ea06093cc667069e..ebdb2ee1cd86bc189349b205a26366262ecd0747 100644 (file)
@@ -4,7 +4,7 @@ USING: accessors build-from-source environment html.parser
 html.parser.analyzer http.client io.backend io.directories
 io.encodings.utf8 io.files io.files.temp io.launcher
 io.pathnames kernel multiline qw sequences sorting.human
 html.parser.analyzer http.client io.backend io.directories
 io.encodings.utf8 io.files io.files.temp io.launcher
 io.pathnames kernel multiline qw sequences sorting.human
-sorting.slots windows.shell32 ;
+windows.shell32 ;
 IN: build-from-source.windows
 
 ! choco install -y meson StrawberryPerl nasm winflexbison3 glfw3
 IN: build-from-source.windows
 
 ! choco install -y meson StrawberryPerl nasm winflexbison3 glfw3
index be8861296691098e0642181615a2196676441320..8869d59d587c4949f7ca75f84d066f88723b14e5 100644 (file)
@@ -2,7 +2,7 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors combinators combinators.short-circuit kernel
 math.order ranges sequences sequences.generalizations
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors combinators combinators.short-circuit kernel
 math.order ranges sequences sequences.generalizations
-sequences.parser sorting.functor sorting.slots unicode ;
+sequences.parser sorting unicode ;
 IN: c.lexer
 
 : take-c-comment ( sequence-parser -- seq/f )
 IN: c.lexer
 
 : take-c-comment ( sequence-parser -- seq/f )
@@ -91,10 +91,7 @@ IN: c.lexer
 : take-c-identifier ( sequence-parser -- string/f )
     [ (take-c-identifier) ] with-sequence-parser ;
 
 : take-c-identifier ( sequence-parser -- string/f )
     [ (take-c-identifier) ] with-sequence-parser ;
 
-<< "length" [ length ] define-sorting >>
-
-: sort-tokens ( seq -- seq' )
-    { length>=< <=> } sort-by ;
+: sort-tokens ( seq -- seq' ) [ length ] inv-sort-by ;
 
 : take-c-integer ( sequence-parser -- string/f )
     [
 
 : take-c-integer ( sequence-parser -- string/f )
     [
index ecf84555460678486e95a7bab65715140475306e..9ead19053b6fa40784ccf302b063ab5d9984705a 100644 (file)
@@ -54,7 +54,7 @@ TUPLE: code-file
         dup detect-file dup binary?
         [ f ] [ 2dup dupd first-line find-mode ] if
         code-file boa
         dup detect-file dup binary?
         [ f ] [ 2dup dupd first-line find-mode ] if
         code-file boa
-    ] map [ mode>> ] filter [ name>> ] sort-with ;
+    ] map [ mode>> ] filter [ name>> ] sort-by ;
 
 : html-name-char ( char -- str )
     {
 
 : html-name-char ( char -- str )
     {
@@ -67,7 +67,7 @@ TUPLE: code-file
     [ html-name-char ] { } map-as concat ".html" append ;
 
 : toc-list ( files -- list )
     [ html-name-char ] { } map-as concat ".html" append ;
 
 : toc-list ( files -- list )
-    [ name>> ] map natural-sort [
+    [ name>> ] map sort [
         [ file-html-name ] keep
         [XML <li><a href=<->><-></a></li> XML]
     ] map ;
         [ file-html-name ] keep
         [XML <li><a href=<->><-></a></li> XML]
     ] map ;
index a479388b96e6eed779fcfd804d9187da203dbd03..00ef2894af91dbf30865328c6166b7eb421b7e2f 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors colors combinators combinators.smart formatting
 ! Copyright (C) 2009 Slava Pestov.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors colors combinators combinators.smart formatting
-kernel literals math math.functions models sorting.human
-sorting.slots strings ui ui.gadgets.scrollers
-ui.gadgets.search-tables ui.gadgets.tables ;
+kernel literals math math.functions models sorting.human strings
+ui ui.gadgets.scrollers ui.gadgets.search-tables
+ui.gadgets.tables ;
 IN: color-table
 
 ! ui.gadgets.tables demo
 IN: color-table
 
 ! ui.gadgets.tables demo
@@ -39,7 +39,7 @@ M: color-renderer row-value
     drop named-color ;
 
 : <color-table> ( -- table )
     drop named-color ;
 
 : <color-table> ( -- table )
-    named-colors { humani<=> } sort-by <model>
+    named-colors humani-sort <model>
     color-renderer
     [ ] <search-table> dup table>>
         5 >>gap
     color-renderer
     [ ] <search-table> dup table>>
         5 >>gap
index 8e6aa02414f5fdd8d86d7b1b8b90a5bb89c6bfb2..14b63a114415c334852f89174a10a3f7961625b8 100644 (file)
@@ -25,7 +25,7 @@ GENERIC: run-command-loop ( command-loop -- )
         nl
         "Commands available:" print
         "===================" print
         nl
         "Commands available:" print
         "===================" print
-        nip commands>> [ name>> ] map natural-sort
+        nip commands>> [ name>> ] map sort
         [ 6 <groups> ] [ longest length 4 + ] bi
         '[ [ _ CHAR: \s pad-tail write ] each nl ] each nl
     ] [
         [ 6 <groups> ] [ longest length 4 + ] bi
         '[ [ _ CHAR: \s pad-tail write ] each nl ] each nl
     ] [
index 2c27728e609d01323f0436320c9395e9b0691692..1d0d1d37cadebfbd0dc6e2be2fc06b54c1880501 100644 (file)
@@ -26,7 +26,7 @@ M: object expr>str unparse ;
     ] if ;
 
 : gvns ( -- str )
     ] if ;
 
 : gvns ( -- str )
-    vregs>vns get >alist natural-sort [
+    vregs>vns get >alist sort [
         first2 value-mapping
     ] map "" concat-as ;
 
         first2 value-mapping
     ] map "" concat-as ;
 
@@ -36,9 +36,9 @@ M: object expr>str unparse ;
     ] keep ;
 
 : congruence-classes ( -- str )
     ] keep ;
 
 : congruence-classes ( -- str )
-    vregs>vns get invert-assoc >alist natural-sort [
+    vregs>vns get invert-assoc >alist sort [
         first2
         first2
-        natural-sort [ number>string ] map ", " join
+        sort [ number>string ] map ", " join
         over exprs>vns get value-at expr>str
         "<%d> : {%s} (%s)\\l" sprintf
     ] map "" concat-as ;
         over exprs>vns get value-at expr>str
         "<%d> : {%s} (%s)\\l" sprintf
     ] map "" concat-as ;
index 4187326181354d73f6bea089178151c1207fbdbe..ddb074cc044c42ada14eeaf739b938896dcf5e50 100644 (file)
@@ -33,7 +33,7 @@ CONSTANT: aliases {
 
 : contributors ( -- )
     changelog histogram merge-aliases
 
 : contributors ( -- )
     changelog histogram merge-aliases
-    sort-values <reversed>
+    inv-sort-values
     simple-table. ;
 
 MAIN: contributors
     simple-table. ;
 
 MAIN: contributors
index 7650f8a24b082fb105aabbd683f2fdbbe69ce658..a99f8b363f24fb77c0a87266ee756491500b9338 100644 (file)
@@ -31,13 +31,13 @@ IN: cursors.tests
     [
         H{ { "roses" "lutefisk" } { "tulips" "lox" } }
         [ ": " glue , ] assoc-each
     [
         H{ { "roses" "lutefisk" } { "tulips" "lox" } }
         [ ": " glue , ] assoc-each
-    ] { } make natural-sort
+    ] { } make sort
 ] unit-test
 
 { { "roses: lutefisk" "tulips: lox" } }
 [
     H{ { "roses" "lutefisk" } { "tulips" "lox" } }
 ] unit-test
 
 { { "roses: lutefisk" "tulips: lox" } }
 [
     H{ { "roses" "lutefisk" } { "tulips" "lox" } }
-    [ ": " glue ] { } assoc>map natural-sort
+    [ ": " glue ] { } assoc>map sort
 ] unit-test
 
 : compile-test-each ( xs -- )
 ] unit-test
 
 : compile-test-each ( xs -- )
@@ -58,11 +58,11 @@ IN: cursors.tests
 { { "roses: lutefisk" "tulips: lox" } }
 [
     [ H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc-each ]
 { { "roses: lutefisk" "tulips: lox" } }
 [
     [ H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc-each ]
-    { } make natural-sort
+    { } make sort
 ] unit-test
 
 { { "roses: lutefisk" "tulips: lox" } }
 [
     H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc>map
 ] unit-test
 
 { { "roses: lutefisk" "tulips: lox" } }
 [
     H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc>map
-    natural-sort
+    sort
 ] unit-test
 ] unit-test
index c31bf5ffc29e6ee069a011d5986bb7798d110ca4..7f1c9f0b67337354a0dc11d890166e4880f5674d 100644 (file)
@@ -8,7 +8,7 @@ vocabs.parser ;
 IN: did-you-mean
 
 : did-you-mean-restarts ( possibilities -- restarts )
 IN: did-you-mean
 
 : did-you-mean-restarts ( possibilities -- restarts )
-    natural-sort
+    sort
     [ [ [ vocabulary>> ] [ name>> ] bi "Use %s:%s" sprintf ] keep ]
     { } map>assoc ;
 
     [ [ [ vocabulary>> ] [ name>> ] bi "Use %s:%s" sprintf ] keep ]
     { } map>assoc ;
 
index e07c2bb9618b0bd79bfdda8589e2443bddd9a7c6..330151d7e9a0d5995fa07ce8c2d6825d9741a3d1 100644 (file)
@@ -1,7 +1,7 @@
 
 USING: enigma kernel math sequences sorting tools.test ;
 
 
 USING: enigma kernel math sequences sorting tools.test ;
 
-{ t } [ <reflector> natural-sort 26 <iota> sequence= ] unit-test
+{ t } [ <reflector> sort 26 <iota> sequence= ] unit-test
 
 { "" } [ "" 4 <enigma> encode ] unit-test
 
 
 { "" } [ "" 4 <enigma> encode ] unit-test
 
index 6a5d92f2903a57b98c279033c927390666630640..31da53a38b40ed75ff095a341cd57c29c67aa7d3 100644 (file)
@@ -25,10 +25,10 @@ IN: fuel.xref
     [ word? ] filter [ word>xref ] map ;
 
 : group-xrefs ( xrefs -- xrefs' )
     [ word? ] filter [ word>xref ] map ;
 
 : group-xrefs ( xrefs -- xrefs' )
-    natural-sort [ second ] collect-by
+    sort [ second ] collect-by
     ! Change key from 'name' to { name path }
     [ [ [ third ] map-find drop 2array ] keep ] assoc-map
     ! Change key from 'name' to { name path }
     [ [ [ third ] map-find drop 2array ] keep ] assoc-map
-    >alist natural-sort ;
+    >alist sort ;
 
 : filter-prefix ( seq prefix -- seq )
     [ drop-prefix nip empty? ] curry filter members ;
 
 : filter-prefix ( seq prefix -- seq )
     [ drop-prefix nip empty? ] curry filter members ;
@@ -71,4 +71,4 @@ PRIVATE>
 : get-vocabs/prefix ( prefix -- seq ) all-disk-vocab-names swap filter-prefix ;
 
 : get-vocabs-words/prefix ( prefix names/f -- seq )
 : get-vocabs/prefix ( prefix -- seq ) all-disk-vocab-names swap filter-prefix ;
 
 : get-vocabs-words/prefix ( prefix names/f -- seq )
-    [ vocabs-words ] [ current-words ] if* natural-sort swap filter-prefix ;
+    [ vocabs-words ] [ current-words ] if* sort swap filter-prefix ;
index 2677ee1ae1d36311db7312a22247302a1d7b8328..fb7fed7bbd0498fa1ae158498c119efeb8906031 100644 (file)
@@ -58,7 +58,7 @@ TUPLE: gemini-server < threaded-server
     path [
         [ name>> "." head? ] reject
         [ { [ directory? ] [ regular-file? ] } 1|| ] filter
     path [
         [ name>> "." head? ] reject
         [ { [ directory? ] [ regular-file? ] } 1|| ] filter
-        [ name>> ] sort-with
+        [ name>> ] sort-by
         [
             [ name>> ] [ directory? [ "/" append ] when ] bi
             [
         [
             [ name>> ] [ directory? [ "/" append ] when ] bi
             [
index 41c6985a8061ccc3a3f97d044113d298bfc9a51e..66604e2bf320f3225564508fc46bd46c818849f5 100644 (file)
@@ -74,7 +74,7 @@ GML: slice ( array n k -- slice )
 GML:: subarray ( array n k -- slice )
     k n k + array subseq ;
 GML: sort-number-permutation ( array -- permutation )
 GML:: subarray ( array n k -- slice )
     k n k + array subseq ;
 GML: sort-number-permutation ( array -- permutation )
-    zip-index sort-keys reverse values ;
+    zip-index sort-keys <reversed> values ;
 
 ! Dictionaries
 ERROR: not-a-dict object ;
 
 ! Dictionaries
 ERROR: not-a-dict object ;
index 5c57c6773f087384b445555b2e3cb19e11245a7c..8607754b82ab130383d63eb065f0072e5f44bbd2 100644 (file)
@@ -64,7 +64,7 @@ TUPLE: gopher-server < threaded-server
     path [
         [ name>> "." head? ] reject
         [ { [ directory? ] [ regular-file? ] } 1|| ] filter
     path [
         [ name>> "." head? ] reject
         [ { [ directory? ] [ regular-file? ] } 1|| ] filter
-        [ name>> ] sort-with
+        [ name>> ] sort-by
         [
             [ gopher-type ] [ name>> ] [ directory? [ "/" append ] when ] tri
             [
         [
             [ gopher-type ] [ name>> ] [ directory? [ "/" append ] when ] tri
             [
index aba301cf0ca59c241e21fc849e04bc7440a42e34..7ded41d31e19b22212275a3234deeae36761485f 100644 (file)
@@ -547,7 +547,7 @@ SYNTAX: UNIFORM-TUPLE:
     [ [ length ] [ c:int >c-array ] bi glDrawBuffers ] if ;
 
 : bind-named-output-attachments ( program-instance framebuffer attachments -- )
     [ [ length ] [ c:int >c-array ] bi glDrawBuffers ] if ;
 
 : bind-named-output-attachments ( program-instance framebuffer attachments -- )
-    rot '[ first _ swap output-index ] sort-with values
+    rot '[ first _ swap output-index ] sort-by values
     bind-unnamed-output-attachments ;
 
 : bind-output-attachments ( program-instance framebuffer attachments -- )
     bind-unnamed-output-attachments ;
 
 : bind-output-attachments ( program-instance framebuffer attachments -- )
index 202ea456db0bcf53bc25787833ffd1c1419a82fc..987d4f55ce55459fa0c2bfae5c43002b631611fb 100644 (file)
@@ -19,8 +19,8 @@ PRIVATE>
 { f } [ \ a-defined-word empty-examples? ] unit-test
 { f } [ \ keep empty-examples? ] unit-test
 
 { f } [ \ a-defined-word empty-examples? ] unit-test
 { f } [ \ keep empty-examples? ] unit-test
 
-{ { $description $values } } [ \ an-empty-word-with-a-unique-name missing-sections natural-sort ] unit-test
-{ { $description $values } } [ \ a-defined-word missing-sections natural-sort ] unit-test
+{ { $description $values } } [ \ an-empty-word-with-a-unique-name missing-sections sort ] unit-test
+{ { $description $values } } [ \ a-defined-word missing-sections sort ] unit-test
 { { } } [ \ keep missing-sections ] unit-test
 
 { { "a.b" "a.b.c" } } [ { "a.b" "a.b.private" "a.b.c.private" "a.b.c" } filter-private ] unit-test
 { { } } [ \ keep missing-sections ] unit-test
 
 { { "a.b" "a.b.c" } } [ { "a.b" "a.b.private" "a.b.c.private" "a.b.c" } filter-private ] unit-test
index 891a50e46531abad462bde161861c2a71a568c39..ddfbcc6b7fe57070dcd0f7d55239ca95973426c6 100644 (file)
@@ -90,7 +90,7 @@ M: word-help-coverage summary
     } case ;
 
 : sorted-loaded-child-vocabs ( prefix -- assoc )
     } case ;
 
 : sorted-loaded-child-vocabs ( prefix -- assoc )
-    loaded-child-vocab-names natural-sort ; inline
+    loaded-child-vocab-names sort ; inline
 
 : filter-private ( seq -- no-private )
     [ ".private" ?tail nip ] reject ; inline
 
 : filter-private ( seq -- no-private )
     [ ".private" ?tail nip ] reject ; inline
@@ -143,7 +143,7 @@ M: string <word-help-coverage>
 
 : <vocab-help-coverage> ( vocab-spec -- coverage )
     dup loaded-vocab? [
 
 : <vocab-help-coverage> ( vocab-spec -- coverage )
     dup loaded-vocab? [
-        [ auto-use? off vocab-words natural-sort [ <word-help-coverage> ] map ] with-scope
+        [ auto-use? off vocab-words sort [ <word-help-coverage> ] map ] with-scope
     ] [
         unloaded-vocab
     ] if ;
     ] [
         unloaded-vocab
     ] if ;
index 3adec513f8827b1e75689513439f13370d45b2ba..d96478d3c34b65d6e8a0c42bf12d5bff94eb9fc5 100644 (file)
@@ -30,5 +30,5 @@ DESTRUCTOR: freeifaddrs
         { void* } [ getifaddrs io-error ] with-out-parameters
         &freeifaddrs ifaddrs deref
         [ ifa_next>> ] follow
         { void* } [ getifaddrs io-error ] with-out-parameters
         &freeifaddrs ifaddrs deref
         [ ifa_next>> ] follow
-        [ ifa_name>> ] map members natural-sort
+        [ ifa_name>> ] map members sort
     ] with-destructors ;
     ] with-destructors ;
index 236fce210c603ebeacc0cfa15002ee0645d6828d..f22541d8a07e94b0194d16b4c84942f03e9c16ac 100644 (file)
@@ -44,7 +44,7 @@ ERROR: atlas-image-formats-dont-match images ;
     stripe-height ;
 
 :: (pack-images) ( images atlas-width sort-quot -- placements )
     stripe-height ;
 
 :: (pack-images) ( images atlas-width sort-quot -- placements )
-    images sort-quot inv-sort-with [ f image-placement boa ] map :> image-placements
+    images sort-quot inv-sort-by [ f image-placement boa ] map :> image-placements
     0 :> @y!
     [ image-placements atlas-width @y (pack-stripe) ] [ @y + @y! ] while*
     image-placements ; inline
     0 :> @y!
     [ image-placements atlas-width @y (pack-stripe) ] [ @y + @y! ] while*
     image-placements ; inline
index 1c6ef39f81ce46355a97d6374a0fc55d6bd772a7..de1cf4fc9281c327f9dbf234527adb0c1f7d4911 100644 (file)
@@ -68,7 +68,7 @@ SYMBOL: terms
     ] if ;
 
 : permutation ( seq -- perm )
     ] if ;
 
 : permutation ( seq -- perm )
-    [ natural-sort ] keep [ index ] curry map ;
+    [ sort ] keep [ index ] curry map ;
 
 : (inversions) ( n seq -- n )
     [ > ] with count ;
 
 : (inversions) ( n seq -- n )
     [ > ] with count ;
@@ -83,7 +83,7 @@ SYMBOL: terms
         2drop 0 { }
     ] [
         dup permutation inversions -1^ rot *
         2drop 0 { }
     ] [
         dup permutation inversions -1^ rot *
-        swap natural-sort
+        swap sort
     ] if ;
 
 : wedge ( x y -- x.y )
     ] if ;
 
 : wedge ( x y -- x.y )
@@ -147,11 +147,11 @@ DEFER: (d)
     ] map sift 2nip ;
 
 : basis ( generators -- seq )
     ] map sift 2nip ;
 
 : basis ( generators -- seq )
-    natural-sort dup length 2^ <iota> [ nth-basis-elt ] with map ;
+    sort dup length 2^ <iota> [ nth-basis-elt ] with map ;
 
 : (tensor) ( seq1 seq2 -- seq )
     [
 
 : (tensor) ( seq1 seq2 -- seq )
     [
-        [ prepend natural-sort ] curry map
+        [ prepend sort ] curry map
     ] with map concat ;
 
 : tensor ( graded-basis1 graded-basis2 -- bigraded-basis )
     ] with map concat ;
 
 : tensor ( graded-basis1 graded-basis2 -- bigraded-basis )
index a5b319b5c1c74d61436b50a7683eb1944322c3a0..962ced0010b1d2ce18950859602fffb42a4dd62b 100644 (file)
@@ -232,7 +232,7 @@ PRIVATE>
 
 : find-unused-in-string ( string -- seq )
     strip-code [ get-imported-words ] [ find-used-words ] bi
 
 : find-unused-in-string ( string -- seq )
     strip-code [ get-imported-words ] [ find-used-words ] bi
-        reject-unused-vocabs natural-sort ;
+        reject-unused-vocabs sort ;
 
 : find-unused-in-file ( path -- seq )
     utf8 file-contents find-unused-in-string ;
 
 : find-unused-in-file ( path -- seq )
     utf8 file-contents find-unused-in-string ;
@@ -243,4 +243,4 @@ PRIVATE>
 : find-unused. ( name -- )
     dup find-unused dup empty?
         [ print-no-unused-vocabs ]
 : find-unused. ( name -- )
     dup find-unused dup empty?
         [ print-no-unused-vocabs ]
-           [ print-unused-vocabs ] if ;
\ No newline at end of file
+           [ print-unused-vocabs ] if ;
index 3516446b74a8622daba5adff30ea1e88aaaee305..bb4ee9b00a2d40e5a612418a96d548b0396c0f59 100644 (file)
@@ -9,7 +9,7 @@ USING: assocs kernel lru-cache sorting tools.test ;
     3 3 pick set-at
     4 4 pick set-at
     5 5 pick set-at
     3 3 pick set-at
     4 4 pick set-at
     5 5 pick set-at
-    >alist natural-sort
+    >alist sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -22,7 +22,7 @@ USING: assocs kernel lru-cache sorting tools.test ;
     1 over at drop
     4 4 pick set-at
     5 5 pick set-at
     1 over at drop
     4 4 pick set-at
     5 5 pick set-at
-    >alist natural-sort
+    >alist sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -37,7 +37,7 @@ USING: assocs kernel lru-cache sorting tools.test ;
     2 over at drop
     4 4 pick set-at
     5 5 pick set-at
     2 over at drop
     4 4 pick set-at
     5 5 pick set-at
-    >alist natural-sort
+    >alist sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -49,7 +49,7 @@ USING: assocs kernel lru-cache sorting tools.test ;
     3 3 pick set-at
     4 4 pick set-at
     5 5 pick set-at
     3 3 pick set-at
     4 4 pick set-at
     5 5 pick set-at
-    >alist natural-sort
+    >alist sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -62,7 +62,7 @@ USING: assocs kernel lru-cache sorting tools.test ;
     1 1 pick set-at
     4 4 pick set-at
     5 5 pick set-at
     1 1 pick set-at
     4 4 pick set-at
     5 5 pick set-at
-    >alist natural-sort
+    >alist sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -74,7 +74,7 @@ USING: assocs kernel lru-cache sorting tools.test ;
     3 3 pick set-at
     4 4 pick set-at
     5 5 pick set-at
     3 3 pick set-at
     4 4 pick set-at
     5 5 pick set-at
-    >alist natural-sort
+    >alist sort
 ] unit-test
 
 {
 ] unit-test
 
 {
@@ -87,5 +87,5 @@ USING: assocs kernel lru-cache sorting tools.test ;
     1 over delete-at
     4 4 pick set-at
     5 5 pick set-at
     1 over delete-at
     4 4 pick set-at
     5 5 pick set-at
-    >alist natural-sort
+    >alist sort
 ] unit-test
 ] unit-test
index 5693907daac52400dc3331779dda9c7066a36b65..8bff74af8dcdf8c00185230df84738cd67b4affa 100644 (file)
@@ -10,7 +10,7 @@ IN: machine-learning.decision-trees
     normalized-histogram values entropy 2 log / ;
 
 : group-by-sorted ( seq quot: ( elt -- key ) -- groups )
     normalized-histogram values entropy 2 log / ;
 
 : group-by-sorted ( seq quot: ( elt -- key ) -- groups )
-    [ sort-with ] keep group-by ; inline
+    [ sort-by ] keep group-by ; inline
 
 : subsets-weighted-entropy ( data-target idx -- seq )
     ! Group the data according to the given index.
 
 : subsets-weighted-entropy ( data-target idx -- seq )
     ! Group the data according to the given index.
index be016f86d5d3dac83ffa50f0eae1cbd01fb88fa5..a118ade1f12a25088f603599f19382c42fb5e6e7 100644 (file)
@@ -10,7 +10,7 @@ TUPLE: label-binarizer classes_ ;
     label-binarizer new ; inline
 
 M: label-binarizer fit-y
     label-binarizer new ; inline
 
 M: label-binarizer fit-y
-    [ members natural-sort ] dip classes_<< ;
+    [ members sort ] dip classes_<< ;
 
 M: label-binarizer transform-y
     classes_>> dup length '[
 
 M: label-binarizer transform-y
     classes_>> dup length '[
index dd0c485557b0b160eed418cd9f919ea2228ee08e..1da7d0b7a3e92fa6cffaf731ad6b2ca6dea7c661 100644 (file)
@@ -9,7 +9,7 @@ TUPLE: label-encoder classes_ ;
 : <label-encoder> ( -- le ) label-encoder new ; inline
 
 M: label-encoder fit-y ( y transformer -- )
 : <label-encoder> ( -- le ) label-encoder new ; inline
 
 M: label-encoder fit-y ( y transformer -- )
-    [ members natural-sort ] dip classes_<< ;
+    [ members sort ] dip classes_<< ;
 
 M: label-encoder transform-y ( y transformer -- y' )
     classes_>> '[ _ bisect-left ] map ;
 
 M: label-encoder transform-y ( y transformer -- y' )
     classes_>> '[ _ bisect-left ] map ;
index 40a74d8f0d74a5fbd84faffecbfdd32b20831e03..fba2bb0d7cc6f3a7468d24c38b20f70456a54550 100644 (file)
@@ -29,7 +29,7 @@ CONSTANT: line-beginning "-!- "
 : handle-help ( string -- )
     [
         "Commands: "
 : handle-help ( string -- )
     [
         "Commands: "
-        commands get keys natural-sort ", " join append send-line
+        commands get keys sort ", " join append send-line
     ] [
         chat-docs get ?at
         [ send-line ]
     ] [
         chat-docs get ?at
         [ send-line ]
index 67203926457f17dc792a2e2edee47119b98df59b..0416ae5b6ff2bea45afb68c806d3c9098f2cc6b7 100644 (file)
@@ -47,7 +47,7 @@ IN: mason.test
 :: do-step ( errors summary-file details-file -- )
     errors
     [ error-type +linkage-error+ eq? ] reject
 :: do-step ( errors summary-file details-file -- )
     errors
     [ error-type +linkage-error+ eq? ] reject
-    [ path>> ] map members natural-sort summary-file to-file
+    [ path>> ] map members sort summary-file to-file
     errors details-file utf8 [ errors. ] with-file-writer ;
 
 : do-tests ( -- )
     errors details-file utf8 [ errors. ] with-file-writer ;
 
 : do-tests ( -- )
index e3ac7af7da9ac0d32d3dbf0315a63d8cf7cc04a8..50de00759507f6f3f7a16e11af2eedd988d27ea9 100644 (file)
@@ -170,7 +170,7 @@ PRIVATE>
 <PRIVATE
 
 :: (gini) ( seq -- x )
 <PRIVATE
 
 :: (gini) ( seq -- x )
-    seq natural-sort :> sorted
+    seq sort :> sorted
     seq length :> len
     sorted 0 [ + ] cum-reduce :> ( a b )
     b len a * / :> c
     seq length :> len
     sorted 0 [ + ] cum-reduce :> ( a b )
     b len a * / :> c
index a698a5c15092bd51f8856ef5015efb8f95e527cf..bbe083fed9bde4ea3850935c55c014d1a70d8426 100644 (file)
@@ -7,7 +7,7 @@ IN: math.transforms.bwt
 ! Semi-efficient versions of Burrows-Wheeler Transform
 
 :: bwt ( seq -- i newseq )
 ! Semi-efficient versions of Burrows-Wheeler Transform
 
 :: bwt ( seq -- i newseq )
-    seq all-rotations natural-sort
+    seq all-rotations sort
     [ [ n>> 0 = ] find drop ] keep
     [ last ] seq map-as ;
 
     [ [ n>> 0 = ] find drop ] keep
     [ last ] seq map-as ;
 
index 248929194ef1670ff41e42ea34b441cb08031924..0fb6ad14e1bf827d8dd9353413b16ab889195a9f 100644 (file)
@@ -101,5 +101,5 @@ PRIVATE>
 [ "5" x m/set ] with-memcached
 [ "valuex" y m/set ] with-memcached
 { { "5" "valuex" } } [
 [ "5" x m/set ] with-memcached
 [ "valuex" y m/set ] with-memcached
 { { "5" "valuex" } } [
-    [ x y z 3array m/getseq values natural-sort ] with-memcached
+    [ x y z 3array m/getseq values sort ] with-memcached
 ] unit-test
 ] unit-test
index dfd3bbf459c40c529264da22dbc3ce7943bfadec..83324d456f6ef09ae993b0cbed126fe7b31f29d0 100644 (file)
@@ -52,7 +52,7 @@ SYMBOL: total
 
         [ [ canonicalize-specializer-1 ] dip ] assoc-map
 
 
         [ [ canonicalize-specializer-1 ] dip ] assoc-map
 
-        hooks [ natural-sort ] change
+        hooks [ sort ] change
 
         [ [ canonicalize-specializer-2 ] dip ] assoc-map
 
 
         [ [ canonicalize-specializer-2 ] dip ] assoc-map
 
index 01c94d4aad1d7c35a6524fa3e96e6e2228e4404d..d39249340ebc2ad573424cdb76b6f118c7f06d28 100644 (file)
@@ -22,7 +22,7 @@ ERROR: no-pair-method a b generic ;
 
 : sorted-pair-methods ( word -- alist )
     "pair-generic-methods" word-prop >alist
 
 : sorted-pair-methods ( word -- alist )
     "pair-generic-methods" word-prop >alist
-    [ first method-sort-key ] inv-sort-with ;
+    [ first method-sort-key ] inv-sort-by ;
 
 : pair-generic-definition ( word -- def )
     [ sorted-pair-methods [ first2 pair-method-cond ] map ]
 
 : pair-generic-definition ( word -- def )
     [ sorted-pair-methods [ first2 pair-method-cond ] map ]
index ce325b85622bb918a09e1b572805a75d37ffe3d6..746c162d22572eaffde78dc2d78d0d9cfef45cc5 100644 (file)
@@ -53,7 +53,7 @@ TYPED:: <papier-renderer> ( -- renderer: papier-renderer )
 
 : order-slabs ( slabs eye -- slabs' )
     ! NO
 
 : order-slabs ( slabs eye -- slabs' )
     ! NO
-    ! '[ center>> _ v- norm-sq ] inv-sort-with ; inline
+    ! '[ center>> _ v- norm-sq ] inv-sort-by ; inline
     drop ;
 
 : render-slabs ( slabs -- vertices indexes )
     drop ;
 
 : render-slabs ( slabs -- vertices indexes )
index e672edb959aed3078af88806298ce5072a500d6f..c0e57c0d13418b4cc2a2a533e97239d30b6a783b 100644 (file)
@@ -106,7 +106,7 @@ MEMO: routes ( -- hash ) $[ { "ABD" "BC" "C" "DCE" "ECF" } [ unclip swap 2array
     "" 2sequence H{ { "AB" 1 } { "AD" 2 } { "BC" 5 } { "DC" 2 } { "DE" 1 } { "EC" 2 } { "EF" 1 } } at ;
 
 : test2 ( fromto -- path considered )
     "" 2sequence H{ { "AB" 1 } { "AD" 2 } { "BC" 5 } { "DC" 2 } { "DE" 1 } { "EC" 2 } { "EF" 1 } } at ;
 
 : test2 ( fromto -- path considered )
-    first2 [ n ] [ c ] [ 2drop 0 ] <astar> [ find-path ] [ considered natural-sort >string ] bi ;
+    first2 [ n ] [ c ] [ 2drop 0 ] <astar> [ find-path ] [ considered sort >string ] bi ;
 >>
 
 ! Check path from A to C -- all nodes but F must have been examined
 >>
 
 ! Check path from A to C -- all nodes but F must have been examined
@@ -129,7 +129,7 @@ MEMO: costs ( -- costs )
     routes keys [ dup dup n [ dup [ c ] dip swap 2array ] with { } map-as >hashtable 2array ] map >hashtable ;
 
 : test3 ( fromto -- path considered )
     routes keys [ dup dup n [ dup [ c ] dip swap 2array ] with { } map-as >hashtable 2array ] map >hashtable ;
 
 : test3 ( fromto -- path considered )
-    first2 costs <dijkstra> [ find-path ] [ considered natural-sort >string ] bi ;
+    first2 costs <dijkstra> [ find-path ] [ considered sort >string ] bi ;
 
 >>
 
 
 >>
 
index b2334cc4321303bb15a98476e634efff1ab1d333..5cc7a4d3097f5738405e5cf7a13349c4eb30f469 100644 (file)
@@ -24,7 +24,7 @@ IN: project-euler.004
     100 999 [a..b] [ 10 divisor? ] reject ;
 
 : max-palindrome ( seq -- palindrome )
     100 999 [a..b] [ 10 divisor? ] reject ;
 
 : max-palindrome ( seq -- palindrome )
-    natural-sort [ palindrome? ] find-last nip ;
+    sort [ palindrome? ] find-last nip ;
 
 PRIVATE>
 
 
 PRIVATE>
 
index ac44102b19ab98d32e2186fa34cd97b62d49d556..93213ae0df9f9103056f7cf5a1ffe625bec5a64c 100644 (file)
@@ -34,7 +34,7 @@ IN: project-euler.009
         [ sq ] bi@
         [ - 2 / , ]      ! b = (p² - q²) / 2
         [ + 2 / , ] 2bi  ! c = (p² + q²) / 2
         [ sq ] bi@
         [ - 2 / , ]      ! b = (p² - q²) / 2
         [ + 2 / , ] 2bi  ! c = (p² + q²) / 2
-    ] { } make natural-sort ;
+    ] { } make sort ;
 
 : (ptriplet) ( target p q triplet -- target p q )
     sum pickd = [ next-pq 2dup abc (ptriplet) ] unless ;
 
 : (ptriplet) ( target p q triplet -- target p q )
     sum pickd = [ next-pq 2dup abc (ptriplet) ] unless ;
index 1b2d058697c7701ba7eb6df0672a854836daaed6..ff27a5a9ff11a16cea174fa1aa7aa8954f1d93c2 100644 (file)
@@ -37,7 +37,7 @@ IN: project-euler.022
 PRIVATE>
 
 : euler022 ( -- answer )
 PRIVATE>
 
 : euler022 ( -- answer )
-    source-022 natural-sort name-scores sum ;
+    source-022 sort name-scores sum ;
 
 ! [ euler022 ] 100 ave-time
 ! 74 ms ave run time - 5.13 SD (100 trials)
 
 ! [ euler022 ] 100 ave-time
 ! 74 ms ave run time - 5.13 SD (100 trials)
index d0b0ab66c0926da3f60f96280ff55fee34d7bf6e..d8dc345fc32c580d429a430a85dfca8018343e40 100644 (file)
@@ -82,7 +82,7 @@ PRIVATE>
     [ unclip 1 head prefix concat ] map [ all-unique? ] filter ;
 
 : add-missing-digit ( seq -- seq )
     [ unclip 1 head prefix concat ] map [ all-unique? ] filter ;
 
 : add-missing-digit ( seq -- seq )
-    dup natural-sort 10 <iota> swap diff prepend ;
+    dup sort 10 <iota> swap diff prepend ;
 
 : interesting-pandigitals ( -- seq )
     17 candidates { 13 11 7 5 3 2 } [
 
 : interesting-pandigitals ( -- seq )
     17 candidates { 13 11 7 5 3 2 } [
index b947e3cb5ebc80d76bdca1f3f91372f6cf8595dc..c5d73ec3af7cf0beb8b2ae1424bb05a17bd9c6ab 100644 (file)
@@ -27,7 +27,7 @@ IN: project-euler.052
     <iota> [ 1 + * ] with map ; inline
 
 : all-same-digits? ( seq -- ? )
     <iota> [ 1 + * ] with map ; inline
 
 : all-same-digits? ( seq -- ? )
-    [ number>digits natural-sort ] map all-equal? ;
+    [ number>digits sort ] map all-equal? ;
 
 : candidate? ( n -- ? )
     { [ odd? ] [ 3 divisor? ] } 1&& ;
 
 : candidate? ( n -- ? )
     { [ odd? ] [ 3 divisor? ] } 1&& ;
index 675b551a745f11dd84304ebb9c0b67856165fad5..41ac21903d38d5a30d0dab2f35467af6f8e72258 100644 (file)
@@ -24,7 +24,7 @@ IN: project-euler.062
 <PRIVATE
 
 : cube ( n -- n^3 ) 3 ^ ; inline
 <PRIVATE
 
 : cube ( n -- n^3 ) 3 ^ ; inline
-: >key ( n -- k ) cube number>digits natural-sort ; inline
+: >key ( n -- k ) cube number>digits sort ; inline
 : has-entry? ( n assoc -- ? ) [ >key ] dip key? ; inline
 
 : (euler062) ( n assoc -- n )
 : has-entry? ( n assoc -- ? ) [ >key ] dip key? ; inline
 
 : (euler062) ( n assoc -- n )
index 518101597643532ee24e85a313877f8d4bc11167..f02077c7d12cc0e76cd208d0ec81a0d21c5d5f22 100644 (file)
@@ -34,7 +34,7 @@ IN: project-euler.112
 <PRIVATE
 
 : bouncy? ( n -- ? )
 <PRIVATE
 
 : bouncy? ( n -- ? )
-    number>digits dup natural-sort
+    number>digits dup sort
     [ = not ] [ reverse = not ] 2bi and ;
 
 PRIVATE>
     [ = not ] [ reverse = not ] 2bi and ;
 
 PRIVATE>
index 43eabaefb1d337c23d7d8d98348cc2cc448d6c4a..f796e789568694dffa28c083600dbdba64aa58ce 100644 (file)
@@ -85,7 +85,7 @@ PRIVATE>
     number>string dup reverse = ;
 
 : pandigital? ( n -- ? )
     number>string dup reverse = ;
 
 : pandigital? ( n -- ? )
-    number>string natural-sort >string "123456789" = ;
+    number>string sort >string "123456789" = ;
 
 : pentagonal? ( n -- ? )
     dup 0 > [ 24 * 1 + sqrt 1 + 6 / 1 mod zero? ] [ drop f ] if ; inline
 
 : pentagonal? ( n -- ? )
     dup 0 > [ 24 * 1 + sqrt 1 + 6 / 1 mod zero? ] [ drop f ] if ; inline
index 82104a5485a33d094ffe8875b96a81fb381b424a..ba02eb69510136d350573119dd2a0affeaa9d6ab 100644 (file)
@@ -32,7 +32,7 @@ CONSTANT: DIGITS $[ "abcdefghijklmnopqrstuvwxyz0123456789" >byte-array ]
     ] while BASE delta * delta SKEW + /i + ;
 
 : segregate ( str -- base extended )
     ] while BASE delta * delta SKEW + /i + ;
 
 : segregate ( str -- base extended )
-    [ N < ] partition members natural-sort ;
+    [ N < ] partition members sort ;
 
 :: find-pos ( str ch i pos -- i' pos' )
     i pos 1 + str [
 
 :: find-pos ( str ch i pos -- i' pos' )
     i pos 1 + str [
index f3186ac8418af64248b0d503f3853b165e9c44e2..7c4fa546d671cd309472c60af6be77f2d0de45db 100644 (file)
@@ -81,7 +81,7 @@ IN: quadtrees.tests
         "c" { -0.5  -0.75 } value>>key
         "d" {  0.75  0.25 } value>>key
 
         "c" { -0.5  -0.75 } value>>key
         "d" {  0.75  0.25 } value>>key
 
-    { -0.6 -0.8 } { 0.8 1.0 } <rect> swap in-rect natural-sort
+    { -0.6 -0.8 } { 0.8 1.0 } <rect> swap in-rect sort
 ] unit-test
 
 { T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
 ] unit-test
 
 { T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
@@ -197,7 +197,7 @@ IN: quadtrees.tests
         "g" {  0.25  0.25 } value>>key
         "h" {  0.75  0.75 } value>>key
 
         "g" {  0.25  0.25 } value>>key
         "h" {  0.75  0.75 } value>>key
 
-        >alist natural-sort
+        >alist sort
 ] unit-test
 
 TUPLE: pointy-thing center ;
 ] unit-test
 
 TUPLE: pointy-thing center ;
index 6670e97b004f6344338e77294178c47d873320bf..e9156e418d0cd95c4df0fa11f61e12afba18b261 100644 (file)
@@ -30,7 +30,7 @@ IN: redis.tests
 { { "aa" "ab" "ac" } } [
     [
         { "aa" "ab" "ac" "bd" } [ "hello" swap redis-set ] each
 { { "aa" "ab" "ac" } } [
     [
         { "aa" "ab" "ac" "bd" } [ "hello" swap redis-set ] each
-        "a*" redis-keys natural-sort
+        "a*" redis-keys sort
     ] with-redis-test
 ] unit-test
 
     ] with-redis-test
 ] unit-test
 
index 1719d09225ed20f7f54a5ed1a7b1db6971044194..9dccb37a3e0c07674dd68b8217899b415826c181 100644 (file)
@@ -120,7 +120,7 @@ M: lambda-word word-noise-factor
 : noisy-words ( -- alist )
     all-words flatten-generics
     [ word-noise-factor ] zip-with
 : noisy-words ( -- alist )
     all-words flatten-generics
     [ word-noise-factor ] zip-with
-    sort-values reverse ;
+    inv-sort-values ;
 
 : noise. ( alist -- )
     standard-table-style [
 
 : noise. ( alist -- )
     standard-table-style [
@@ -140,7 +140,7 @@ M: lambda-word word-noise-factor
 
 : noisy-vocabs ( -- alist )
     loaded-vocab-names [ vocab-noise-factor ] zip-with
 
 : noisy-vocabs ( -- alist )
     loaded-vocab-names [ vocab-noise-factor ] zip-with
-    sort-values reverse ;
+    inv-sort-values ;
 
 : noise-report ( -- )
     "NOISY WORDS:" print
 
 : noise-report ( -- )
     "NOISY WORDS:" print
index b9d5788d107a350e899eb2a16c1db1ede69eda2f..ea35eb08a9d853285ccca0de451a380ce1110da2 100644 (file)
@@ -27,7 +27,7 @@ IN: rosettacode.anagrams-deranged
     utf8 file-lines
     H{ } clone [
         '[
     utf8 file-lines
     H{ } clone [
         '[
-            [ natural-sort >string ] keep
+            [ sort >string ] keep
             _ [ swap suffix  ] with change-at
         ] each
     ] keep ;
             _ [ swap suffix  ] with change-at
         ] each
     ] keep ;
@@ -39,7 +39,7 @@ IN: rosettacode.anagrams-deranged
     parse-dict-file anagrams [ derangements ] map concat ;
 
 : (longest-deranged-anagrams) ( path -- anagrams )
     parse-dict-file anagrams [ derangements ] map concat ;
 
 : (longest-deranged-anagrams) ( path -- anagrams )
-    deranged-anagrams [ first length ] sort-with last ;
+    deranged-anagrams [ first length ] sort-by last ;
 
 : default-word-list ( -- path )
     URL" https://puzzlers.org/pub/wordlists/unixdict.txt"
 
 : default-word-list ( -- path )
     URL" https://puzzlers.org/pub/wordlists/unixdict.txt"
index 922c028650f8725418e6e26e1453bcdd2cd13625..83706269713040e93d2f1c5c67a32294babb81d6 100644 (file)
@@ -42,4 +42,4 @@ PRIVATE>
 ! How many ways can we make the given amount of cents
 ! with the given set of coins?
 : make-change ( cents coins -- ways )
 ! How many ways can we make the given amount of cents
 ! with the given set of coins?
 : make-change ( cents coins -- ways )
-    members [ ] inv-sort-with (make-change) ;
+    members inv-sort (make-change) ;
index 84a048ac42d4527300ce1d9a2f240ebaf3e2a671..377c57e6010c7b173c29d75853637df6aff175d7 100644 (file)
@@ -97,7 +97,7 @@ CONSTANT: limit 400
     solve-knapsack
     "Total value: " write number>string print
     "Items packed: " print
     solve-knapsack
     "Total value: " write number>string print
     "Items packed: " print
-    natural-sort
+    sort
     [ "   " write print ] each ;
 
 MAIN: knapsack-main
     [ "   " write print ] each ;
 
 MAIN: knapsack-main
index a0d0c0dcbfe4e8612630dda09a3e2b1043f22f52..e44766b0f6e5a42e8775ebe6afaea7aeea73305f 100644 (file)
@@ -48,7 +48,7 @@ CONSTANT: employees {
 
 : prepare-departments ( seq -- departments )
     [ department>> ] collect-by
 
 : prepare-departments ( seq -- departments )
     [ department>> ] collect-by
-    [ [ salary>> ] inv-sort-with ] assoc-map ;
+    [ [ salary>> ] inv-sort-by ] assoc-map ;
 
 : first-n-each ( seq n quot -- )
     [ index-or-length head-slice ] dip each ; inline
 
 : first-n-each ( seq n quot -- )
     [ index-or-length head-slice ] dip each ; inline
index f2f6496181a967ced14822a132ff0c023c5100ec..4fdfd3a774a261b09c610bd8b75dc51db958fd5f 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors assocs base64 calendar calendar.format
 calendar.parser checksums.hmac checksums.sha combinators http
 http.client kernel make math.order namespaces sequences
 USING: accessors assocs base64 calendar calendar.format
 calendar.parser checksums.hmac checksums.sha combinators http
 http.client kernel make math.order namespaces sequences
-sorting sorting.slots strings xml xml.traversal ;
+sorting strings xml xml.traversal ;
 IN: s3
 
 SYMBOL: key-id
 IN: s3
 
 SYMBOL: key-id
@@ -16,7 +16,7 @@ TUPLE: s3-request path mime-type date method headers bucket data ;
 : hashtable>headers ( hashtable -- seq )
     [
         [ swap % ":" % % "\n" % ] "" make
 : hashtable>headers ( hashtable -- seq )
     [
         [ swap % ":" % % "\n" % ] "" make
-    ] { } assoc>map [ <=> ] sort ;
+    ] { } assoc>map sort ;
 
 : signature ( s3-request -- string )
     [
 
 : signature ( s3-request -- string )
     [
@@ -84,7 +84,7 @@ PRIVATE>
     f "/" H{ } clone s3-get nip >string string>xml (buckets) ;
 
 : sorted-buckets ( -- seq )
     f "/" H{ } clone s3-get nip >string string>xml (buckets) ;
 
 : sorted-buckets ( -- seq )
-    buckets { { date>> rfc3339>timestamp <=> } } sort-by ;
+    buckets [ date>> rfc3339>timestamp ] sort-by ;
 
 <PRIVATE
 : bucket-url ( bucket -- string )
 
 <PRIVATE
 : bucket-url ( bucket -- string )
index 10fc73d65607d64f0b05b89ebe9b650ced1605d8..d93152e001f1b7c90d04a76d4f9add5a9f1e76a9 100644 (file)
@@ -218,5 +218,5 @@ CONSTANT: semver-gt-comparisons {
         "2.0.0"
         "2.1.0"
         "2.1.1"
         "2.0.0"
         "2.1.0"
         "2.1.1"
-    } dup clone randomize [ semver<=> ] sort =
+    } dup clone randomize [ semver<=> ] sort-with =
 ] unit-test
 ] unit-test
index 1ce9c04b40f38b31b2fc219b5825600ac74dacb5..9490168140e4ea34fe213be03bbb3c127bb6de13 100644 (file)
@@ -81,7 +81,7 @@ C: <snake-part> snake-part
     [ dir>> move-loc ] accumulate nip ;
 
 : snake-occupied-indices ( snake head-loc -- points )
     [ dir>> move-loc ] accumulate nip ;
 
 : snake-occupied-indices ( snake head-loc -- points )
-    snake-occupied-locs [ game-loc>index ] map natural-sort ;
+    snake-occupied-locs [ game-loc>index ] map sort ;
 
 : snake-unoccupied-indices ( snake head-loc -- points )
     [ all-indices ] 2dip snake-occupied-indices without ;
 
 : snake-unoccupied-indices ( snake head-loc -- points )
     [ all-indices ] 2dip snake-occupied-indices without ;
index 0dbe1263e5d97ef0bce6f2cfb82a303bcd2a6ac3..d14521ccd44c8e3e69cc53e3070dcdc8c86a483e 100644 (file)
@@ -1,5 +1,5 @@
 USING: kernel sorting.bubble tools.test ;
 
 USING: kernel sorting.bubble tools.test ;
 
-{ { } } [ { } dup natural-bubble-sort! ] unit-test
-{ { 1 } } [ { 1 } dup natural-bubble-sort! ] unit-test
-{ { 1 2 3 4 5 } } [ { 1 4 2 5 3 } dup natural-bubble-sort! ] unit-test
+{ { } } [ { } dup bubble-sort! ] unit-test
+{ { 1 } } [ { 1 } dup bubble-sort! ] unit-test
+{ { 1 2 3 4 5 } } [ { 1 4 2 5 3 } dup bubble-sort! ] unit-test
index 74115774c8b22692e19646ff31782f0105f97dbc..adb5c0a1646d4c300805b31049ea139a67aedc99 100644 (file)
@@ -8,7 +8,7 @@ IN: sorting.bubble
 
 <PRIVATE
 
 
 <PRIVATE
 
-:: (bubble-sort!) ( seq quot: ( obj1 obj2 -- <=> ) -- )
+:: (bubble-sort-with!) ( seq quot: ( obj1 obj2 -- <=> ) -- )
     seq length 1 - [
         f over [0..b) [| i |
             i i 1 + [ seq nth-unsafe ] bi@ 2dup quot call +gt+ =
     seq length 1 - [
         f over [0..b) [| i |
             i i 1 + [ seq nth-unsafe ] bi@ 2dup quot call +gt+ =
@@ -19,8 +19,7 @@ IN: sorting.bubble
 
 PRIVATE>
 
 
 PRIVATE>
 
-: bubble-sort! ( seq quot: ( obj1 obj2 -- <=> ) -- )
-    over length 2 < [ 2drop ] [ (bubble-sort!) ] if ; inline
+: bubble-sort-with! ( seq quot: ( obj1 obj2 -- <=> ) -- )
+    over length 2 < [ 2drop ] [ (bubble-sort-with!) ] if ; inline
 
 
-: natural-bubble-sort! ( seq -- )
-    [ <=> ] bubble-sort! ;
+: bubble-sort! ( seq -- ) [ <=> ] bubble-sort-with! ;
index ae90b05109da4d47d3fc810c180a5b7974396135..7adb7191712511d8c34ec0efaee5c2b81a3cb249 100644 (file)
@@ -5,11 +5,11 @@ IN: sorting.extras
 : argsort ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
     [ zip-index ] dip
     [ [ first-unsafe ] bi@ ] prepose
 : argsort ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
     [ zip-index ] dip
     [ [ first-unsafe ] bi@ ] prepose
-    sort [ second-unsafe ] map! ; inline
+    sort-with [ second-unsafe ] map! ; inline
 
 : map-sort ( ... seq quot: ( ... elt -- ... key ) -- ... sortedseq )
     [ keep ] curry { } map>assoc
 
 : map-sort ( ... seq quot: ( ... elt -- ... key ) -- ... sortedseq )
     [ keep ] curry { } map>assoc
-    [ { array } declare first-unsafe ] sort-with
+    [ { array } declare first-unsafe ] sort-by
     [ { array } declare second-unsafe ] map ; inline
 
 :: bisect-left ( obj seq -- i )
     [ { array } declare second-unsafe ] map ; inline
 
 :: bisect-left ( obj seq -- i )
index ddaefbee311ad39d967faf3627b3ce736f95ce90..f2319eed3317b1dea2bd2d5b3023120e17aa34c4 100644 (file)
@@ -1,12 +1,12 @@
 USING: kernel sequences sorting.quick tools.test ;
 
 USING: kernel sequences sorting.quick tools.test ;
 
-{ { } } [ { } dup natural-sort! ] unit-test
-{ { 1 } } [ { 1 } dup natural-sort! ] unit-test
-{ { 1 2 3 4 5 } } [ { 1 4 2 5 3 } dup natural-sort! ] unit-test
+{ { } } [ { } dup sort! ] unit-test
+{ { 1 } } [ { 1 } dup sort! ] unit-test
+{ { 1 2 3 4 5 } } [ { 1 4 2 5 3 } dup sort! ] unit-test
 
 {
     { "dino" "fred" "wilma" "betty" "barney" "pebbles" "bamm-bamm" }
 } [
     { "fred" "wilma" "pebbles" "dino" "barney" "betty" "bamm-bamm" }
 
 {
     { "dino" "fred" "wilma" "betty" "barney" "pebbles" "bamm-bamm" }
 } [
     { "fred" "wilma" "pebbles" "dino" "barney" "betty" "bamm-bamm" }
-    dup [ length ] sort-with!
+    dup [ length ] sort-by!
 ] unit-test
 ] unit-test
index 08476e18e7f2999f10b60c408e6a71f21f08de3b..d153504aa80d77a1a35aad229c7da92509e51250 100644 (file)
@@ -39,18 +39,28 @@ IN: sorting.quick
 
 PRIVATE>
 
 
 PRIVATE>
 
-: sort! ( seq quot: ( obj1 obj2 -- <=> ) -- )
+: sort-with! ( seq quot: ( obj1 obj2 -- <=> ) -- )
     [ 0 over length check-array-capacity 1 - ] dip quicksort ; inline
 
     [ 0 over length check-array-capacity 1 - ] dip quicksort ; inline
 
-: sort-with! ( seq quot: ( elt -- key ) -- )
-    [ compare ] curry sort! ; inline
+: inv-sort-with! ( seq quot: ( obj1 obj2 -- <=> ) -- )
+    '[ @ invert-comparison ] sort-with! ; inline
 
 
-: inv-sort-with! ( seq quot: ( elt -- key ) -- )
-    [ compare invert-comparison ] curry sort! ; inline
+: sort-by! ( seq quot: ( elt -- key ) -- )
+    [ compare ] curry sort-with! ; inline
 
 
-GENERIC: natural-sort! ( seq -- )
+: inv-sort-by! ( seq quot: ( elt -- key ) -- )
+    [ compare invert-comparison ] curry sort-with! ; inline
 
 
-M: object natural-sort!  [ <=> ] sort! ;
-M: array natural-sort! [ <=> ] sort! ;
-M: vector natural-sort! [ <=> ] sort! ;
-M: string natural-sort! [ <=> ] sort! ;
+GENERIC: sort! ( seq -- )
+
+M: object sort! [ <=> ] sort-with! ;
+M: array sort! [ <=> ] sort-with! ;
+M: vector sort! [ <=> ] sort-with! ;
+M: string sort! [ <=> ] sort-with! ;
+
+GENERIC: inv-sort! ( seq -- )
+
+M: object inv-sort! [ <=> ] inv-sort-with! ;
+M: array inv-sort! [ <=> ] inv-sort-with! ;
+M: vector inv-sort! [ <=> ] inv-sort-with! ;
+M: string inv-sort! [ <=> ] inv-sort-with! ;
index 027f9e05844f3283147e02cf628ac5634f0ee4da..3e9f0911322466e2822a93545dfe0d6d9a1f14fb 100644 (file)
@@ -48,7 +48,7 @@ CONSTANT: ALPHABET "abcdefghijklmnopqrstuvwxyz"
     word 1array dictionary filter-known
     [ word edits1 dictionary filter-known ] when-empty
     [ word edits2 dictionary filter-known ] when-empty
     word 1array dictionary filter-known
     [ word edits1 dictionary filter-known ] when-empty
     [ word edits2 dictionary filter-known ] when-empty
-    [ dictionary at ] sort-with reverse! ;
+    [ dictionary at ] sort-by reverse! ;
 
 : words ( string -- words )
     >lower [ letter? not ] split-when harvest ;
 
 : words ( string -- words )
     >lower [ letter? not ] split-when harvest ;
index 4487a9ed982bce2c6644f39e77bf0c46f93a42c6..e55d4aef98e05949a399aed32a98099d6a66288c 100644 (file)
@@ -33,7 +33,7 @@ DEFER: write-tree
 
 :: write-tree ( path indents -- )
     path [
 
 :: write-tree ( path indents -- )
     path [
-        [ name>> ] sort-with [ ] [
+        [ name>> ] sort-by [ ] [
             unclip-last [
                 f indents push
                 [ indents write-entry ] each
             unclip-last [
                 f indents push
                 [ indents write-entry ] each
index f98483d5e5ce075b3876809ebbcd9ba548a926f7..d9bfb840fe61eed3902f471629251ef8a1f661d3 100644 (file)
@@ -20,7 +20,7 @@ M: dimensions-not-equal summary drop "Dimensions do not match" ;
 
 : <dimensioned> ( n top bot -- obj )
     symbolic-reduce
 
 : <dimensioned> ( n top bot -- obj )
     symbolic-reduce
-    [ natural-sort ] bi@
+    [ sort ] bi@
     dimensioned boa ;
 
 : >dimensioned< ( d -- n top bot )
     dimensioned boa ;
 
 : >dimensioned< ( d -- n top bot )
index 332283667bfd27cba987cb9084f39fc7e949c5a2..a60dbea3abaa104c5c9d9c268a788b817cf3a7b0 100644 (file)
@@ -83,7 +83,7 @@ M: comment entity-url
     >>comments ;
 
 : reverse-chronological-order ( seq -- sorted )
     >>comments ;
 
 : reverse-chronological-order ( seq -- sorted )
-    [ date>> ] inv-sort-with ;
+    [ date>> ] inv-sort-by ;
 
 : validate-author ( -- )
     { { "author" [ v-username ] } } validate-params ;
 
 : validate-author ( -- )
     { { "author" [ v-username ] } } validate-params ;
index 0e6c3c2b5ca91751729de17ff7b9ce7c756c42f5..b0249421e0634a7678feecf5fadb5ec06475f468 100644 (file)
@@ -19,7 +19,7 @@ CONSTANT: BROKEN
     } cond ;
 
 : builder-list ( seq -- xml )
     } cond ;
 
 : builder-list ( seq -- xml )
-    [ os/cpu ] sort-with
+    [ os/cpu ] sort-by
     [
         [ report-url ] [ os/cpu ] [ builder-status ] tri
         [XML <li><a href=<->><-></a> <-></li> XML]
     [
         [ report-url ] [ os/cpu ] [ builder-status ] tri
         [XML <li><a href=<->><-></a> <-></li> XML]
index 597ab89de1e715fb21f2d4a22f9d758489d60427..5b151e325052cc255a1759bba3a0055b50eac1e6 100644 (file)
@@ -51,7 +51,7 @@ TUPLE: paste-state < entity annotations ;
 
 : pastes ( -- pastes )
     f <paste-state> select-tuples
 
 : pastes ( -- pastes )
     f <paste-state> select-tuples
-    [ date>> ] sort-with
+    [ date>> ] sort-by
     reverse ;
 
 TUPLE: annotation < entity parent ;
     reverse ;
 
 TUPLE: annotation < entity parent ;
index 9e05af31404f9369971c36fb2e4cc8f2ea1898a6..ebbcdba281a01cab619deb03ffc0832e80ced0e5 100644 (file)
@@ -47,11 +47,11 @@ posting "POSTINGS"
 
 : blogroll ( -- seq )
     f <blog> select-tuples
 
 : blogroll ( -- seq )
     f <blog> select-tuples
-    [ name>> ] sort-with ;
+    [ name>> ] sort-by ;
 
 : postings ( -- seq )
     posting new select-tuples
 
 : postings ( -- seq )
     posting new select-tuples
-    [ date>> ] inv-sort-with ;
+    [ date>> ] inv-sort-by ;
 
 : <edit-blogroll-action> ( -- action )
     <page-action>
 
 : <edit-blogroll-action> ( -- action )
     <page-action>
@@ -90,7 +90,7 @@ posting "POSTINGS"
     [ '[ _ <posting> ] map ] 2map concat ;
 
 : sort-entries ( entries -- entries' )
     [ '[ _ <posting> ] map ] 2map concat ;
 
 : sort-entries ( entries -- entries' )
-    [ date>> ] inv-sort-with ;
+    [ date>> ] inv-sort-by ;
 
 : update-cached-postings ( -- )
     blogroll fetch-blogroll sort-entries 8 index-or-length head [
 
 : update-cached-postings ( -- )
     blogroll fetch-blogroll sort-entries 8 index-or-length head [
index 020148c58db242fe1f6e302157d02d6687f38dfd..404c77a8173ec6f69b9e9839cf25586d9557c621 100644 (file)
@@ -57,7 +57,7 @@ M: revision feed-entry-date date>> ;
 M: revision feed-entry-url id>> revision-url ;
 
 : reverse-chronological-order ( seq -- sorted )
 M: revision feed-entry-url id>> revision-url ;
 
 : reverse-chronological-order ( seq -- sorted )
-    [ date>> ] inv-sort-with ;
+    [ date>> ] inv-sort-by ;
 
 : <revision> ( id -- revision )
     revision new swap >>id ;
 
 : <revision> ( id -- revision )
     revision new swap >>id ;
@@ -300,7 +300,7 @@ M: revision feed-entry-url id>> revision-url ;
 
         [
             f <article> select-tuples
 
         [
             f <article> select-tuples
-            [ title>> ] sort-with
+            [ title>> ] sort-by
             "articles" set-value
         ] >>init
 
             "articles" set-value
         ] >>init
 
@@ -322,7 +322,7 @@ M: revision feed-entry-url id>> revision-url ;
 
             [ f ] [
                 f <article> select-tuples
 
             [ f ] [
                 f <article> select-tuples
-                [ title>> ] sort-with
+                [ title>> ] sort-by
                 [ revision>> <revision> select-tuple ] map
                 swap '[ content>> _ [ first-match ] with all? ] filter
             ] if-empty
                 [ revision>> <revision> select-tuple ] map
                 swap '[ content>> _ [ first-match ] with all? ] filter
             ] if-empty
index 6875425ea5f4966b583cc012e22a30e0ac0ce0e1..a14a9a343d18670c585c2ce0436c342fda58ceef 100644 (file)
@@ -50,7 +50,7 @@ TUPLE: wordlet-game secret-word chances guesses ;
     ] with map concat members
     [ background of ] assoc-map
     [ drop ] collect-value-by
     ] with map concat members
     [ background of ] assoc-map
     [ drop ] collect-value-by
-    [ [ color>n ] zip-with sort-values reverse first first ] assoc-map
+    [ [ color>n ] zip-with sort-values <reversed> first first ] assoc-map
     CHAR: a CHAR: z [a..b] [ 1string COLOR: white ] { } map>assoc [ or ] assoc-merge ;
 
 : print-remaining-chars ( game -- )
     CHAR: a CHAR: z [a..b] [ 1string COLOR: white ] { } map>assoc [ or ] assoc-merge ;
 
 : print-remaining-chars ( game -- )
index 60e0a5d70671d57b91840f6ca1925a795c389bdc..2353337686990faef6fe7ec1d6ba48a5b01063c0 100644 (file)
@@ -64,7 +64,7 @@ SYMBOL: *calling*
     *wordtimes* [ (correct-for-timing-overhead) ] change-global ;
 
 : print-word-timings ( -- )
     *wordtimes* [ (correct-for-timing-overhead) ] change-global ;
 
 : print-word-timings ( -- )
-    *wordtimes* get-global [ swap suffix ] { } assoc>map natural-sort reverse pprint ;
+    *wordtimes* get-global [ swap suffix ] { } assoc>map inv-sort pprint ;
 
 : wordtimer-call ( quot -- )
     reset-word-timer
 
 : wordtimer-call ( quot -- )
     reset-word-timer
index 78f5a6b31ef92e7b2bbf7bd33337e27ed7fbe5ed..d75b2f27baa34801bc4e0ab65f7d51fb1cba0726 100644 (file)
@@ -148,7 +148,7 @@ MEMO: zoneinfo-assoc ( -- assoc )
 : zoneinfo-zones ( -- seq )
     raw-zone-map keys
     [ "/" subseq-of? ] partition
 : zoneinfo-zones ( -- seq )
     raw-zone-map keys
     [ "/" subseq-of? ] partition
-    [ natural-sort ] bi@ append ;
+    [ sort ] bi@ append ;
 
 GENERIC: zone-matches? ( string rule -- ? )
 
 
 GENERIC: zone-matches? ( string rule -- ? )
 
index ffb992904784ba599ee043b250f808d2f689a773..46e5d744fd8adeb5d64dfb1d127e802975fc4a0b 100644 (file)
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language: Factor
 " Maintainer: Alex Chapman <chapman.alex@gmail.com>
 " Vim syntax file
 " Language: Factor
 " Maintainer: Alex Chapman <chapman.alex@gmail.com>
-" Last Change: 2022 Aug 06
+" Last Change: 2023 Feb 08
 " Minimum Version: 600
 " To regenerate: USE: editors.vim.generate-syntax generate-vim-syntax
 
 " Minimum Version: 600
 " To regenerate: USE: editors.vim.generate-syntax generate-vim-syntax
 
@@ -19,7 +19,7 @@ command -nargs=+ -bar SynKeywordFactorWord
 
 SynKeywordFactorWord factorWord_alien | syn keyword factorWord_alien contained <alien> <bad-alien> <callback> <displaced-alien> >c-ptr abi abi? alien alien-address alien-assembly alien-callback alien-indirect alien-invoke alien? binary-object byte-length c-ptr c-ptr? callee-cleanup? callsite-not-compiled callsite-not-compiled? cdecl cdecl? dll dll? element-size expired? fastcall fastcall? free-callback initialize-alien mingw mingw? pinned-alien pinned-alien? pinned-c-ptr pinned-c-ptr? stdcall stdcall? thiscall thiscall? unregister-and-free-callback with-callback
 SynKeywordFactorWord factorWord_arrays | syn keyword factorWord_arrays contained 1array 2array 3array 4array <array> >array array array? pair pair? resize-array
 
 SynKeywordFactorWord factorWord_alien | syn keyword factorWord_alien contained <alien> <bad-alien> <callback> <displaced-alien> >c-ptr abi abi? alien alien-address alien-assembly alien-callback alien-indirect alien-invoke alien? binary-object byte-length c-ptr c-ptr? callee-cleanup? callsite-not-compiled callsite-not-compiled? cdecl cdecl? dll dll? element-size expired? fastcall fastcall? free-callback initialize-alien mingw mingw? pinned-alien pinned-alien? pinned-c-ptr pinned-c-ptr? stdcall stdcall? thiscall thiscall? unregister-and-free-callback with-callback
 SynKeywordFactorWord factorWord_arrays | syn keyword factorWord_arrays contained 1array 2array 3array 4array <array> >array array array? pair pair? resize-array
-SynKeywordFactorWord factorWord_assocs | syn keyword factorWord_assocs contained 2cache <enumerated> >alist ?at ?change-at ?delete-at ?of ?value-at assoc assoc-all? assoc-any? assoc-clone-like assoc-diff assoc-diff! assoc-differ assoc-each assoc-empty? assoc-filter assoc-filter! assoc-filter-as assoc-find assoc-hashcode assoc-intersect assoc-intersect-all assoc-like assoc-map assoc-map-as assoc-partition assoc-reject assoc-reject! assoc-reject-as assoc-size assoc-stack assoc-subset? assoc-union assoc-union! assoc-union-all assoc-union-as assoc= assoc>map assoc? at at* at+ cache change-at clear-assoc collect-by delete-at delete-at* enumerated enumerated? extract-keys harvest-keys harvest-values inc-at key? keys map>alist map>assoc maybe-set-at new-assoc of push-at rename-at set-at sift-keys sift-values substitute unzip value-at value-at* value? values zip zip-as zip-index zip-index-as zip-with zip-with-as
+SynKeywordFactorWord factorWord_assocs | syn keyword factorWord_assocs contained 2cache <enumerated> >alist ?at ?change-at ?delete-at ?of ?value-at assoc assoc-all? assoc-any? assoc-clone-like assoc-diff assoc-diff! assoc-differ assoc-each assoc-empty? assoc-filter assoc-filter! assoc-filter-as assoc-find assoc-hashcode assoc-intersect assoc-intersect-all assoc-like assoc-map assoc-map-as assoc-partition assoc-reject assoc-reject! assoc-reject-as assoc-size assoc-stack assoc-subset? assoc-union assoc-union! assoc-union-all assoc-union-as assoc= assoc>map assoc? at at* at+ cache change-at clear-assoc collect-by collect-by! delete-at delete-at* enumerated enumerated? extract-keys harvest-keys harvest-values inc-at key? keys map>alist map>assoc maybe-set-at new-assoc of push-at rename-at set-at sift-keys sift-values substitute unzip value-at value-at* value? values zip zip-as zip-index zip-index-as zip-with zip-with-as
 SynKeywordFactorWord factorWord_byte__arrays | syn keyword factorWord_byte__arrays contained (byte-array) 1byte-array 2byte-array 3byte-array 4byte-array <byte-array> >byte-array byte-array byte-array? byte-sequence byte-sequence? resize-byte-array
 SynKeywordFactorWord factorWord_classes | syn keyword factorWord_classes contained all-contained-classes bad-inheritance bad-inheritance? check-instance class class-members class-of class-participants class-usage class-usages class-uses class? classes classoid classoid? contained-classes create-predicate-word define-predicate defining-class defining-class? forget-class implementors instance? not-an-instance not-an-instance? predicate predicate-def predicate-word predicate? subclass-of? superclass-of superclass-of? superclasses-of
 SynKeywordFactorWord factorWord_classes_maybe | syn keyword factorWord_classes_maybe contained <maybe> maybe maybe-class-or maybe?
 SynKeywordFactorWord factorWord_byte__arrays | syn keyword factorWord_byte__arrays contained (byte-array) 1byte-array 2byte-array 3byte-array 4byte-array <byte-array> >byte-array byte-array byte-array? byte-sequence byte-sequence? resize-byte-array
 SynKeywordFactorWord factorWord_classes | syn keyword factorWord_classes contained all-contained-classes bad-inheritance bad-inheritance? check-instance class class-members class-of class-participants class-usage class-usages class-uses class? classes classoid classoid? contained-classes create-predicate-word define-predicate defining-class defining-class? forget-class implementors instance? not-an-instance not-an-instance? predicate predicate-def predicate-word predicate? subclass-of? superclass-of superclass-of? superclasses-of
 SynKeywordFactorWord factorWord_classes_maybe | syn keyword factorWord_classes_maybe contained <maybe> maybe maybe-class-or maybe?
@@ -34,16 +34,16 @@ SynKeywordFactorWord factorWord_io_encodings | syn keyword factorWord_io_encodin
 SynKeywordFactorWord factorWord_io_encodings_binary | syn keyword factorWord_io_encodings_binary contained binary binary?
 SynKeywordFactorWord factorWord_io_encodings_utf8 | syn keyword factorWord_io_encodings_utf8 contained >utf8-index code-point-length code-point-offsets utf8 utf8-index> utf8?
 SynKeywordFactorWord factorWord_io_files | syn keyword factorWord_io_files contained (file-appender) (file-reader) (file-writer) +input+ +output+ +retry+ <file-appender> <file-reader> <file-writer> change-file-contents change-file-lines drain file-contents file-exists? file-lines file-reader file-reader? file-writer file-writer? init-resource-path refill set-file-contents set-file-lines wait-for-fd with-file-appender with-file-reader with-file-writer
 SynKeywordFactorWord factorWord_io_encodings_binary | syn keyword factorWord_io_encodings_binary contained binary binary?
 SynKeywordFactorWord factorWord_io_encodings_utf8 | syn keyword factorWord_io_encodings_utf8 contained >utf8-index code-point-length code-point-offsets utf8 utf8-index> utf8?
 SynKeywordFactorWord factorWord_io_files | syn keyword factorWord_io_files contained (file-appender) (file-reader) (file-writer) +input+ +output+ +retry+ <file-appender> <file-reader> <file-writer> change-file-contents change-file-lines drain file-contents file-exists? file-lines file-reader file-reader? file-writer file-writer? init-resource-path refill set-file-contents set-file-lines wait-for-fd with-file-appender with-file-reader with-file-writer
-SynKeywordFactorWord factorWord_kernel | syn keyword factorWord_kernel contained (clone) -roll -rot -rotd 2bi 2bi* 2bi@ 2curry 2dip 2drop 2dup 2keep 2keepd 2nip 2nipd 2over 2tri 2tri* 2tri@ 2with 3bi 3curry 3dip 3drop 3dup 3keep 3nip 3nipd 3tri 4dip 4drop 4dup 4keep 4nip 5drop 5nip <wrapper> = >boolean ? ?if and assert assert= assert? bi bi* bi-curry bi-curry* bi-curry@ bi@ boa boolean boolean? both? build call callstack callstack>array callstack? clear clone compose composed composed? curried curried? curry die dip do drop dup dupd either? eq? equal? execute get-callstack get-datastack get-retainstack hashcode hashcode* identity-hashcode identity-tuple identity-tuple? if if* keep keepd keepdd loop most negate new nip nipd not null object or over overd pick pickd prepose reach recursive-hashcode roll rot rotd same? spin swap swapd throw tri tri* tri-curry tri-curry* tri-curry@ tri@ tuck tuple tuple? unless unless* until when when* while while* with withd wrapper wrapper? xor
+SynKeywordFactorWord factorWord_kernel | syn keyword factorWord_kernel contained (clone) -roll -rot -rotd 2bi 2bi* 2bi@ 2curry 2dip 2drop 2dup 2keep 2keepd 2nip 2nipd 2over 2tri 2tri* 2tri@ 2with 3bi 3curry 3dip 3drop 3dup 3keep 3nip 3nipd 3tri 4dip 4drop 4dup 4keep 4nip 5drop 5nip <wrapper> = >boolean ? ?if and assert assert= assert? bi bi* bi-curry bi-curry* bi-curry@ bi@ boa boolean boolean? both? build call callstack callstack>array callstack? clear clone compose composed composed? curried curried? curry die dip do drop dup dupd either? eq? equal? execute get-callstack get-datastack get-retainstack hashcode hashcode* identity-hashcode identity-tuple identity-tuple? if if* keep keepd keepdd loop most negate new nip nipd not null object or over overd pick pickd prepose reach roll rot rotd same? spin swap swapd throw tri tri* tri-curry tri-curry* tri-curry@ tri@ tuck tuple tuple? unless unless* until when when* while while* with withd wrapper wrapper? xor
 SynKeywordFactorWord factorWord_layouts | syn keyword factorWord_layouts contained (first-bignum) (fixnum-bits) (max-array-capacity) 32-bit? 64-bit? bootstrap-cell bootstrap-cell-bits bootstrap-cells bootstrap-first-bignum bootstrap-fixnum-bits bootstrap-max-array-capacity bootstrap-most-negative-fixnum bootstrap-most-positive-fixnum cell cell-bits cells data-alignment first-bignum fixnum-bits hashcode-shift header-bits immediate immediate? leaf-stack-frame-size max-array-capacity mega-cache-size most-negative-fixnum most-positive-fixnum num-types tag-bits tag-fixnum tag-header tag-mask type-number type-numbers untag-fixnum
 SynKeywordFactorWord factorWord_make | syn keyword factorWord_make contained % %% , ,+ ,, building make
 SynKeywordFactorWord factorWord_layouts | syn keyword factorWord_layouts contained (first-bignum) (fixnum-bits) (max-array-capacity) 32-bit? 64-bit? bootstrap-cell bootstrap-cell-bits bootstrap-cells bootstrap-first-bignum bootstrap-fixnum-bits bootstrap-max-array-capacity bootstrap-most-negative-fixnum bootstrap-most-positive-fixnum cell cell-bits cells data-alignment first-bignum fixnum-bits hashcode-shift header-bits immediate immediate? leaf-stack-frame-size max-array-capacity mega-cache-size most-negative-fixnum most-positive-fixnum num-types tag-bits tag-fixnum tag-header tag-mask type-number type-numbers untag-fixnum
 SynKeywordFactorWord factorWord_make | syn keyword factorWord_make contained % %% , ,+ ,, building make
-SynKeywordFactorWord factorWord_math | syn keyword factorWord_math contained * + - / /f /i /mod 2/ 2^ < <= <fp-nan> > >= >bignum >fixnum >float >fraction >integer >rect ?1+ abs align all-integers-from? all-integers? bignum bignum? bit? bitand bitnot bitor bits>double bits>float bitxor complex complex? denominator double>bits each-integer each-integer-from even? find-integer find-integer-from find-last-integer fixnum fixnum? float float>bits float? fp-bitwise= fp-infinity? fp-nan-payload fp-nan? fp-qnan? fp-sign fp-snan? fp-special? gcd if-zero imaginary-part integer integer>fixnum integer>fixnum-strict integer? log2 log2-expects-positive log2-expects-positive? mod neg neg? next-float next-power-of-2 number number= number? numerator odd? power-of-2? prev-float ratio ratio? rational rational? real real-part real? recip rect> rem sgn shift simple-gcd sq times u< u<= u> u>= unless-zero unordered? until-zero when-zero zero?
+SynKeywordFactorWord factorWord_math | syn keyword factorWord_math contained * + - / /f /i /mod 2/ 2^ < <= <fp-nan> > >= >bignum >fixnum >float >fraction >integer >rect ?1+ abs align all-integers-from? all-integers? bignum bignum? bit? bitand bitnot bitor bits>double bits>float bitxor complex complex? denominator double>bits each-integer each-integer-from even? find-integer find-integer-from find-last-integer fixnum fixnum? float float>bits float? fp-bitwise= fp-infinity? fp-nan-payload fp-nan? fp-qnan? fp-sign fp-snan? fp-special? gcd if-zero imaginary-part integer integer>fixnum integer>fixnum-strict integer? log2 log2-expects-positive log2-expects-positive? mod neg neg? next-float next-power-of-2 number number= number? numerator odd? power-of-2? prev-float ratio ratio? rational rational? real real-part real? recip rect> recursive-hashcode rem sgn shift simple-gcd sq times u< u<= u> u>= unless-zero unordered? until-zero when-zero zero?
 SynKeywordFactorWord factorWord_math_order | syn keyword factorWord_math_order contained +eq+ +gt+ +lt+ <=> >=< [-] after=? after? before=? before? between? clamp compare invert-comparison max min
 SynKeywordFactorWord factorWord_memory | syn keyword factorWord_memory contained all-instances compact-gc gc instances minor-gc save save-image save-image-and-exit saving-path size
 SynKeywordFactorWord factorWord_namespaces | syn keyword factorWord_namespaces contained +@ change change-global counter dec get get-global get-namestack global inc init-namestack initialize namespace off on set set-global set-namestack toggle with-global with-scope with-variable with-variables
 SynKeywordFactorWord factorWord_math_order | syn keyword factorWord_math_order contained +eq+ +gt+ +lt+ <=> >=< [-] after=? after? before=? before? between? clamp compare invert-comparison max min
 SynKeywordFactorWord factorWord_memory | syn keyword factorWord_memory contained all-instances compact-gc gc instances minor-gc save save-image save-image-and-exit saving-path size
 SynKeywordFactorWord factorWord_namespaces | syn keyword factorWord_namespaces contained +@ change change-global counter dec get get-global get-namestack global inc init-namestack initialize namespace off on set set-global set-namestack toggle with-global with-scope with-variable with-variables
-SynKeywordFactorWord factorWord_sequences | syn keyword factorWord_sequences contained 1sequence 1surround 1surround-as 2all? 2any? 2each 2each-from 2map 2map-as 2map-reduce 2reduce 2selector 2sequence 3append 3append-as 3each 3map 3map-as 3sequence 4sequence <iota> <repetition> <reversed> <slice> >slice< ?first ?last ?nth ?second ?set-nth accumulate accumulate! accumulate* accumulate*! accumulate*-as accumulate-as all? any? append append! append-as assert-sequence assert-sequence= assert-sequence? binary-reduce bounds-check bounds-check? bounds-error bounds-error? but-last but-last-slice cartesian-each cartesian-find cartesian-map cartesian-product cartesian-product-as change-nth check-slice clone-like collapse-slice collector collector-as collector-for collector-for-as concat concat-as copy count cut cut* cut-slice cut-slice* delete-all delete-slice drop-prefix each each-from each-index empty? exchange filter filter! filter-as find find-from find-index find-index-from find-last find-last-from first first2 first3 first4 flip follow fourth from-tail glue glue-as halves harvest head head* head-slice head-slice* head-to-index head? if-empty immutable immutable-sequence immutable-sequence? immutable? index index-from index-of-last index-or-length index-to-tail indices infimum infimum-by insert-nth interleave iota iota? join join-as last last-index last-index-from length lengthen like longer longer? longest map map! map-as map-find map-find-last map-index map-index-as map-integers map-integers-as map-reduce map-sum max-length member-eq? member? midpoint@ min-length mismatch move new-like new-resizable new-sequence non-negative-integer-expected non-negative-integer-expected? none? nth nths pad-head pad-tail partition pop pop* prefix prepend prepend-as produce produce-as product push push-all push-either push-if reduce reduce-index reject reject! reject-as remove remove! remove-eq remove-eq! remove-nth remove-nth! repetition repetition? replace-slice replicate replicate-as rest rest-slice reverse reverse! reversed reversed? second selector selector-as sequence sequence-hashcode sequence= sequence? set-first set-fourth set-last set-length set-nth set-second set-third shorten shorter shorter? shortest sift slice slice-error slice-error? slice? snip snip-slice subseq subseq-as subseq-index subseq-index-from subseq-of? subseq-start subseq-start-from subseq-starts-at? subseq? suffix suffix! sum sum-lengths supremum supremum-by surround surround-as tail tail* tail-slice tail-slice* tail? third trim trim-head trim-head-slice trim-slice trim-tail trim-tail-slice unclip unclip-last unclip-last-slice unclip-slice unless-empty virtual-exemplar virtual-sequence virtual-sequence? virtual@ when-empty
+SynKeywordFactorWord factorWord_sequences | syn keyword factorWord_sequences contained 1sequence 1surround 1surround-as 2all? 2any? 2each 2each-from 2map 2map-as 2map-reduce 2reduce 2selector 2sequence 3append 3append-as 3each 3map 3map-as 3sequence 4sequence <iota> <repetition> <reversed> <slice> >slice< ?first ?last ?nth ?second ?set-nth accumulate accumulate! accumulate* accumulate*! accumulate*-as accumulate-as all? any? append append! append-as assert-sequence assert-sequence= assert-sequence? binary-reduce bounds-check bounds-check? bounds-error bounds-error? but-last but-last-slice cartesian-each cartesian-find cartesian-map cartesian-product cartesian-product-as change-nth check-slice clone-like collapse-slice collector collector-as collector-for collector-for-as concat concat-as copy count cut cut* cut-slice cut-slice* delete-all delete-slice drop-prefix each each-from each-index empty? exchange filter filter! filter-as find find-from find-index find-index-from find-last find-last-from first first2 first3 first4 flip follow fourth from-tail glue glue-as halves harvest head head* head-slice head-slice* head-to-index head? if-empty immutable immutable-sequence immutable-sequence? immutable? index index-from index-of-last index-or-length index-to-tail indices infimum infimum-by insert-nth interleave iota iota? join join-as last last-index last-index-from length lengthen like longer longer? longest map map! map-as map-find map-find-last map-index map-index-as map-integers map-integers-as map-integers-from-as map-reduce map-sum max-length member-eq? member? midpoint@ min-length mismatch move new-like new-resizable new-sequence non-negative-integer-expected non-negative-integer-expected? none? nth nths pad-head pad-tail partition pop pop* prefix prepend prepend-as produce produce-as product push push-all push-either push-if reduce reduce-index reject reject! reject-as remove remove! remove-eq remove-eq! remove-nth remove-nth! repetition repetition? replace-slice replicate replicate-as rest rest-slice reverse reverse! reversed reversed? second selector selector-as sequence sequence-hashcode sequence= sequence? set-first set-fourth set-last set-length set-nth set-second set-third shorten shorter shorter? shortest sift slice slice-error slice-error? slice? snip snip-slice subseq subseq-as subseq-index subseq-index-from subseq-of? subseq-start subseq-start-from subseq-starts-at? subseq? suffix suffix! sum sum-lengths supremum supremum-by surround surround-as tail tail* tail-slice tail-slice* tail? third trim trim-head trim-head-slice trim-slice trim-tail trim-tail-slice unclip unclip-last unclip-last-slice unclip-slice unless-empty virtual-exemplar virtual-sequence virtual-sequence? virtual@ when-empty
 SynKeywordFactorWord factorWord_sets | syn keyword factorWord_sets contained ?adjoin ?delete adjoin adjoin-all adjoin-at all-unique? cardinality clear-set delete diff diff! duplicates fast-set gather in? intersect intersect! intersect-all intersects? members null? set set-like set= set? subset? union union! union-all within without
 SynKeywordFactorWord factorWord_sets | syn keyword factorWord_sets contained ?adjoin ?delete adjoin adjoin-all adjoin-at all-unique? cardinality clear-set delete diff diff! duplicates fast-set gather in? intersect intersect! intersect-all intersects? members null? set set-like set= set? subset? union union! union-all within without
-SynKeywordFactorWord factorWord_sorting | syn keyword factorWord_sorting contained compare-with inv-sort-with natural-sort sort sort-keys sort-pair sort-values sort-with
+SynKeywordFactorWord factorWord_sorting | syn keyword factorWord_sorting contained inv-sort inv-sort-by inv-sort-keys inv-sort-values inv-sort-with sort sort-by sort-keys sort-pair sort-values sort-with
 SynKeywordFactorWord factorWord_splitting | syn keyword factorWord_splitting contained ?head ?head-slice ?snip ?snip-slice ?tail ?tail-slice join-lines join-lines-as join-words join-words-as replace split split-indices split-lines split-slice split-subseq split-when split-when-slice split-words split1 split1-last split1-last-slice split1-slice split1-when split1-when-slice string-lines subseq-range
 SynKeywordFactorWord factorWord_strings | syn keyword factorWord_strings contained 1string <string> >string resize-string string string?
 SynKeywordFactorWord factorWord_strings_parser | syn keyword factorWord_strings_parser contained bad-escape bad-escape? escape name>char-hook parse-string unescape-string
 SynKeywordFactorWord factorWord_splitting | syn keyword factorWord_splitting contained ?head ?head-slice ?snip ?snip-slice ?tail ?tail-slice join-lines join-lines-as join-words join-words-as replace split split-indices split-lines split-slice split-subseq split-when split-when-slice split-words split1 split1-last split1-last-slice split1-slice split1-when split1-when-slice string-lines subseq-range
 SynKeywordFactorWord factorWord_strings | syn keyword factorWord_strings contained 1string <string> >string resize-string string string?
 SynKeywordFactorWord factorWord_strings_parser | syn keyword factorWord_strings_parser contained bad-escape bad-escape? escape name>char-hook parse-string unescape-string