]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: remove (indices).
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 29 Dec 2016 00:40:27 +0000 (16:40 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 29 Dec 2016 00:40:27 +0000 (16:40 -0800)
core/sequences/sequences.factor

index f38365741e100d8ca8d1547649465bd63fcda54a..b559d3659483be15bb3b8e291bb2eec565bf52ad 100644 (file)
@@ -635,16 +635,10 @@ PRIVATE>
 : last-index-from ( obj i seq -- n )
     rot [ = ] curry find-last-from drop ;
 
-<PRIVATE
-
-: (indices) ( elt i obj accum -- )
-    [ swap [ = ] dip ] dip [ push ] 2curry when ; inline
-
-PRIVATE>
-
 : indices ( obj seq -- indices )
-    swap V{ } clone
-    [ [ (indices) ] 2curry each-index ] keep ;
+    swap [ = ] curry [ swap ] prepose V{ } clone [
+        [ push ] curry [ [ drop ] if ] curry compose each-index
+    ] keep ;
 
 <PRIVATE