: 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
- [ { array } declare first-unsafe ] sort-with
+ [ { array } declare first-unsafe ] sort-by
[ { array } declare second-unsafe ] map ; inline
:: bisect-left ( obj seq -- i )