]> gitweb.factorcode.org Git - factor.git/commitdiff
kernel: higher-order effects for *keep
authorJoe Groff <arcata@gmail.com>
Fri, 14 Oct 2011 17:44:42 +0000 (10:44 -0700)
committerJoe Groff <arcata@gmail.com>
Fri, 14 Oct 2011 17:45:02 +0000 (10:45 -0700)
core/kernel/kernel.factor

index 7cf700535034276bc1b83b47804e4a6a866fd728..307445c9f47cd809f4ee9aeaaef38af01a9a607a 100644 (file)
@@ -64,11 +64,14 @@ DEFER: if
 : 4dip ( w x y z quot -- w x y z ) swap [ 3dip ] dip ; inline
 
 ! Keepers
-: keep ( x quot -- x ) over [ call ] dip ; inline
+: keep ( ..a x quot: ( ..a x -- ..b ) -- ..b x )
+    over [ call ] dip ; inline
 
-: 2keep ( x y quot -- x y ) [ 2dup ] dip 2dip ; inline
+: 2keep ( ..a x y quot: ( ..a x y -- ..b ) -- ..b x y )
+    [ 2dup ] dip 2dip ; inline
 
-: 3keep ( x y z quot -- x y z ) [ 3dup ] dip 3dip ; inline
+: 3keep ( ..a x y z quot: ( ..a x y z -- ..b ) -- ..b x y z )
+    [ 3dup ] dip 3dip ; inline
 
 ! Cleavers
 : bi ( x p q -- )