sorting.extras: better tests and fix zip order.
parent
9d6f2ad353
commit
fd7ec79b20
|
@ -6,4 +6,7 @@ IN: sorting.extras
|
|||
{ "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
|
||||
|
|
|
@ -7,5 +7,5 @@ IN: sorting.extras
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue