: test-two ( str1 str2 -- )\r
[ +lt+ ] -rot [ string<=> ] 2curry unit-test ;\r
\r
-: failures\r
- parse-test dup 2 <clumps>\r
- [ string<=> +lt+ = not ] assoc-filter dup assoc-size ;\r
-\r
-: test-equality\r
+: test-equality ( str1 str2 -- )\r
{ primary= secondary= tertiary= quaternary= }\r
[ execute ] with with each ;\r
\r
] { } map-as concat ;\r
\r
: append-weights ( weights quot -- )\r
- swap [ ignorable?>> not ] filter\r
- swap map [ zero? not ] filter % 0 , ;\r
+ [ [ ignorable?>> not ] filter ] dip\r
+ map [ zero? not ] filter % 0 , ; inline\r
\r
: variable-weight ( weight -- )\r
dup ignorable?>> [ primary>> ] [ drop HEX: FFFF ] if , ;\r
<PRIVATE\r
: insensitive= ( str1 str2 levels-removed -- ? )\r
[\r
- swap collation-key swap\r
+ [ collation-key ] dip\r
[ [ 0 = not ] trim-right but-last ] times\r
] curry bi@ = ;\r
PRIVATE>\r
PRIVATE>\r
\r
: sort-strings ( strings -- sorted )\r
- [ w/collation-key ] map\r
- natural-sort values ;\r
+ [ w/collation-key ] map natural-sort values ;\r
\r
: string<=> ( str1 str2 -- <=> )\r
[ w/collation-key ] compare ;\r