]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences.extras: add a nullable span-slices word that allows f.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 10 Apr 2016 18:38:42 +0000 (11:38 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 10 Apr 2016 18:39:50 +0000 (11:39 -0700)
extra/sequences/extras/extras.factor

index b057f6e4c208acaee5ceaf5a8ecc6bd28cf94b30..664100765a5dae381ef571783c98116635520634 100644 (file)
@@ -207,6 +207,9 @@ ERROR: underlying-mismatch slice1 slice2 ;
     [ [ to>> ] bi@ max ]
     [ drop seq>> ] 2tri <slice> ;
 
+: ?span-slices ( slice1/f slice2/f -- slice )
+    2dup and [ span-slices ] [ or ] if ;
+
 :: rotate! ( seq n -- )
     seq length :> len
     n len mod dup 0 < [ len + ] when seq bounds-check drop 0 over