| Adrian Kubala 2005-11-07, 10:03 pm |
| On 2005-11-06, Vesa Karvonen <vesa.karvonen@cs.helsinki.fi> wrote:
> For an example of a special binding construct look at the do-notation
> in Haskell (specifically the subnotation "v <- e"). Another example
> would be a parser generator macro in Scheme that allows you to name
> right hand sides for use in semantic actions (instead of using
> positional references like in Yacc).
I have to chime in that I wrote a toy port of Parsec using exactly this
idea:
Haskell: do { p1; x <- p2; p3; return x }
becomes Lisp: (p& p1 (<- x p2) p3 (p^ x))
No doubt Haskell people feel that the builtin "do" notation cleanly
eliminates the need for a whole class of binding, sequencing,
backtracking, and control-flow macros, and they like having it
standardized. On the other hand, it's nice that you can get the same
effect in Lisp even though the language designers had probably never
heard of a monad. Personally I think Lisp macros are like a magic
wormhole that puts you just one step away from tons of widely-separated
language features... but wormholes are dangerous and some people would
prefer to have a fast, efficient public transportation system instead.
|