combinators.cleave.enhanced: Cleavers and spreaders which accept words

db4
Eduardo Cavazos 2008-11-29 12:07:35 -06:00
parent f72f9a8f45
commit 14d00b3e83
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
USING: combinators.cleave fry kernel macros parser quotations ;
IN: combinators.cleave.enhanced
: \\
scan-word literalize parsed
scan-word literalize parsed ; parsing
MACRO: bi ( p q -- quot )
[ >quot ] dip
>quot
'[ _ _ [ keep ] dip call ] ;
MACRO: tri ( p q r -- quot )
[ >quot ] 2dip
[ >quot ] dip
>quot
'[ _ _ _ [ [ keep ] dip keep ] dip call ] ;
MACRO: bi* ( p q -- quot )
[ >quot ] dip
>quot
'[ _ _ [ dip ] dip call ] ;
MACRO: tri* ( p q r -- quot )
[ >quot ] 2dip
[ >quot ] dip
>quot
'[ _ _ _ [ [ 2dip ] dip dip ] dip call ] ;