[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

deep nesting and Trailing parens

Howard Stearns wrote:

> It remains to be demonstrated (as far as I know) that macro-definition
> can be made easy enough in the face of things like using noise keywords
> instead of balanced delimiters:

Not entirely.  Here's a silly example:

  (bind (x y z) 
     to (1 2 3) 
     in (+ x y z))

which evaluates to


I define this with the macro

  (define-syntax (bind expr)
    (syntax-case expr (to in)
      [(_ (names ...) to (values ...) in body ...)
	(let ([names values]
	  body ...))]))