{ "hello" "goodbye" "yo" } [ [ length ] bi@ <=> ] argsort
] unit-test
-{ 1 { 2 3 4 5 } } [ 1 { 1 2 3 4 } [ dupd + ] map-sort ] unit-test
+{ { "blue" "green" "purple" } } [
+ { "green" "blue" "purple" } [ length ] map-sort
+] unit-test
+{ 1 { 1 2 3 4 } } [ 1 { 4 2 1 3 } [ dupd + ] map-sort ] unit-test
sort [ second-unsafe ] map! ; inline
: map-sort ( ... seq quot: ( ... elt -- ... key ) -- ... sortedseq )
- [ map ] curry keep zip [ second-unsafe ] sort-with
- [ first-unsafe ] map ; inline
+ [ map ] curry keep zip [ first-unsafe ] sort-with
+ [ second-unsafe ] map ; inline