Hello,

Marc Fauconneau (prunedtree on #concatenative) made a brilliant suggestion a 
while back. Have '\\' and '\\\' words and use them with enhanced versions of 
the cleavers/spreaders which accept words as well as quotations. E.g.:

    10 \\ 1- 1+ bi    --->    9 11

Which would currently be written:

    10 [ 1- ] [ 1+ ] bi

I've been trying out the above idiom and it's very very nice.

Code below...

Ed

----------------------------------------------------------------------

USING: combinators.cleave fry kernel macros parser quotations ;

IN: 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 ] ;

----------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to