]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: require integers for slice and repetition.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 21 Feb 2014 09:01:43 +0000 (01:01 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 21 Feb 2014 16:36:31 +0000 (08:36 -0800)
core/sequences/sequences-docs.factor
core/sequences/sequences.factor

index ad0d557637462b0774e347760cc43f66845676e0..108806f08d5c4e2f5af29b3565a87bac7fd62a4c 100644 (file)
@@ -1120,7 +1120,7 @@ HELP: trim-tail-slice
 { $examples
     { $example "USING: prettyprint math sequences ;"
                "{ 0 0 1 2 3 0 0 } [ zero? ] trim-tail-slice ."
-               "T{ slice { from 0 } { to 5 } { seq { 0 0 1 2 3 0 0 } } }"
+               "T{ slice { to 5 } { seq { 0 0 1 2 3 0 0 } } }"
     }
 } ;
 
index 2662c6c7209ace35055b276c15719c5727906738..62b5e840f21b002fd701db4123027189383361ef 100644 (file)
@@ -214,8 +214,8 @@ INSTANCE: reversed virtual-sequence
 
 ! A slice of another sequence.
 TUPLE: slice
-{ from read-only }
-{ to read-only }
+{ from integer read-only }
+{ to integer read-only }
 { seq read-only } ;
 
 : collapse-slice ( m n slice -- m' n' seq )
@@ -266,7 +266,7 @@ M: slice length [ to>> ] [ from>> ] bi - ; inline
 INSTANCE: slice virtual-sequence
 
 ! One element repeated many times
-TUPLE: repetition { len read-only } { elt read-only } ;
+TUPLE: repetition { len integer read-only } { elt read-only } ;
 
 : <repetition> ( len elt -- repetition )
     over 0 < [ non-negative-integer-expected ] when