[racket] Onlisp's condlet macro in Racket

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Jan 2 11:37:47 EST 2013

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/c3741ee0/attachment.html>

Posted on the users mailing list.