sequences.extras: adding "arg-where".

db4
John Benediktsson 2012-09-06 12:28:16 -07:00
parent 10111b5850
commit 4e46d15bcf
1 changed files with 4 additions and 0 deletions

View File

@ -271,3 +271,7 @@ INSTANCE: odds immutable-sequence
: arg-min ( seq -- n )
dup length iota zip [ first-unsafe ] infimum-by second ;
: arg-where ( ... seq quot: ( ... elt -- ... ? ) -- ... indices )
[ dup length iota zip ] dip
[ first-unsafe ] prepose filter values ; inline