add quad combinator

inline the do-while combinator
db4
Doug Coleman 2008-08-16 16:05:00 -05:00
parent dbddc8d590
commit 0eea37c13d
1 changed files with 3 additions and 1 deletions

View File

@ -31,6 +31,8 @@ IN: combinators.lib
! Generalized versions of core combinators
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: quad ( x p q r s -- ) >r >r >r keep r> keep r> keep r> call ; inline
: 4slip ( quot a b c d -- a b c d ) 4 nslip ; inline
: 4keep ( w x y z quot -- w x y z ) 4 nkeep ; inline
@ -137,7 +139,7 @@ MACRO: multikeep ( word out-indexes -- ... )
[ drop ] rot compose attempt-all ; inline
: do-while ( pred body tail -- )
>r tuck 2slip r> while ;
>r tuck 2slip r> while ; inline
: generate ( generator predicate -- obj )
[ dup ] swap [ dup [ nip ] unless not ] 3compose