]> gitweb.factorcode.org Git - factor.git/commitdiff
use iota in replicate
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 23 Aug 2009 00:59:36 +0000 (20:59 -0400)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 23 Aug 2009 00:59:36 +0000 (20:59 -0400)
core/sequences/sequences.factor

index 177a157994b64cc133c1300beff6d07e692bb3b1..de2435c29280603dd7520525498139e72e158b87 100755 (executable)
@@ -99,10 +99,10 @@ M: f like drop [ f ] when-empty ; inline
 INSTANCE: f immutable-sequence
 
 ! Integers support the sequence protocol
-M: integer length ; inline
-M: integer nth-unsafe drop ; inline
+M: integer length ; inline
+M: integer nth-unsafe drop ; inline
 
-INSTANCE: integer immutable-sequence
+INSTANCE: integer immutable-sequence
 
 PRIVATE>
 
@@ -424,9 +424,10 @@ PRIVATE>
     over map-as ; inline
 
 : replicate ( seq quot -- newseq )
-    [ drop ] prepose map ; inline
+    [ iota ] dip [ drop ] prepose map ; inline
 
 : replicate-as ( seq quot exemplar -- newseq )
+    [ iota ] 2dip
     [ [ drop ] prepose ] dip map-as ; inline
 
 : change-each ( seq quot -- )