]> gitweb.factorcode.org Git - factor.git/commitdiff
combinators.extras: Add loop1 which outputs an object
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 1 Apr 2021 02:50:26 +0000 (21:50 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 1 Apr 2021 03:19:15 +0000 (22:19 -0500)
extra/combinators/extras/extras.factor

index aaf49f1f2293938e0f10008848d57a1680407a06..3fd6294b2df634e0e771b3ff42d82235707c0b2c 100644 (file)
@@ -109,3 +109,7 @@ MACRO: chain ( quots -- quot )
 
 : with-output-variable ( value variable quot -- value )
     over [ get ] curry compose with-variable ; inline
+
+: loop1 ( ..a quot: ( ..a -- ..a obj ? ) -- ..a obj )
+    [ call ] keep '[ drop _ loop1 ] when ; inline recursive
+