diff --git a/extra/combinators/cleave/enhanced/enhanced.factor b/extra/combinators/cleave/enhanced/enhanced.factor new file mode 100644 index 0000000000..b55979a791 --- /dev/null +++ b/extra/combinators/cleave/enhanced/enhanced.factor @@ -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 ] ; +