]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: don't allow negative repetitions.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 5 Aug 2013 16:49:24 +0000 (09:49 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 5 Aug 2013 16:56:44 +0000 (09:56 -0700)
core/sequences/sequences.factor

index df4f7b85298ec2dc1fd09e38f896c33040ccdc3c..6a1d0a10ee28ecdf34267cb1ff02c560e98eed93 100644 (file)
@@ -268,7 +268,9 @@ INSTANCE: slice virtual-sequence
 ! One element repeated many times
 TUPLE: repetition { len read-only } { elt read-only } ;
 
-C: <repetition> repetition
+: <repetition> ( len elt -- repetition )
+    over 0 < [ non-negative-integer-expected ] when
+    repetition boa ; inline
 
 M: repetition length len>> ; inline
 M: repetition nth-unsafe nip elt>> ; inline