Permalink
Browse files

kernel: higher-order effects for *keep

  • Loading branch information...
1 parent 1152bab commit 882d7766f919aa229104dbfb1b9f8d68d1a74e39 @jckarter jckarter committed Oct 14, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 core/kernel/kernel.factor
@@ -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 -- )

0 comments on commit 882d776

Please sign in to comment.