]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences.extras: adding "until-empty".
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 31 Aug 2012 22:01:01 +0000 (15:01 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 31 Aug 2012 22:01:01 +0000 (15:01 -0700)
extra/sequences/extras/extras.factor

index ccbb706d61291156f968524e605746bb8d22ca59..b7a897c3e856755ba014f4e76cc3c2eb54c3faa9 100644 (file)
@@ -262,3 +262,6 @@ M: odds length length>> ; inline
 M: odds nth-unsafe [ 2 * 1 + ] [ seq>> nth-unsafe ] bi* ; inline
 
 INSTANCE: odds immutable-sequence
+
+: until-empty ( seq quot -- )
+    [ dup empty? ] swap until drop ; inline