[racket] Onlisp's condlet macro in Racket
I meant to rewrite with syntax-parse before emailing out to show error checking. Out of time.
On Jan 2, 2013, at 11:37 AM, Robby Findler wrote:
>
>
>
> On Wed, Jan 2, 2013 at 10:33 AM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
> Sean, it took me a while to figure out condlet but here is how a Racketeer would write this (questionable) macro:
>
> (define-syntax (condlet stx)
> (syntax-case stx ()
> [(condlet ((c (x e) ...) ...) body ...)
> #'(cond
> [c (let* ((x '()) ... ...)
> (let ((x e) ...)
> body ...))]
> ...)]))
>
> As Stephan points out, a let* suffices here because it simply doesn't matter because it simply doesn't matter which x binding body ... sees.
>
>
> This could be define-syntax-rule, no (since there's no error checking)?
>
> Robby
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130102/2e813b70/attachment.html>