<div dir="ltr">That is a lot more brief than mine. I just adapted a naive, unquoted version from the Racket case:<div><br></div><div><div><font face="monospace, monospace">(define-syntax my-case</font></div><div><font face="monospace, monospace"> (syntax-rules (else)</font></div><div><font face="monospace, monospace"> [(_ val ((mtch ...) expr) rest ... (else expr2)) </font></div><div><font face="monospace, monospace"> (if (my-comp val (mtch ...))</font></div><div><font face="monospace, monospace"> expr</font></div><div><font face="monospace, monospace"> (my-case val rest ... (else expr2)))]</font></div><div><font face="monospace, monospace"> [(_ val ((mtch ...) expr) (else expr2))</font></div><div><font face="monospace, monospace"> (if (my-comp val (mtch ...))</font></div><div><font face="monospace, monospace"> expr</font></div><div><font face="monospace, monospace"> expr2)]</font></div><div><font face="monospace, monospace"> [(_ val (else expr)) expr]</font></div><div><font face="monospace, monospace"> [(_ val ((mtch ...) expr) rest ...)</font></div><div><font face="monospace, monospace"> (my-case val ((mtch ...) expr) rest ... (else #f))]))</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">(define-syntax my-comp</font></div><div><font face="monospace, monospace"> (syntax-rules ()</font></div><div><font face="monospace, monospace"> [(_ v ()) #f]</font></div><div><font face="monospace, monospace"> [(_ v (k)) (equal? v k)]</font></div><div><font face="monospace, monospace"> [(_ v (k ks ...)) (if (equal? v k)</font></div><div><font face="monospace, monospace"> #t</font></div><div><font face="monospace, monospace"> (my-comp v (ks ...)))]))</font></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 23, 2014 at 8:29 PM, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org" target="_blank">eli@barzilay.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Dec 22, 2014 at 12:52 AM, Jon Zeppieri <<a href="mailto:zeppieri@gmail.com">zeppieri@gmail.com</a>> wrote:<br>
> `case` is like C's `switch` (but unlike similar constructs in other<br>
</span><span class="">> C's switch does, however, allow the use of constant *expressions* as<br>
> case labels, so you can have something like `case FOO % 3`, where `FOO<br>
> % 3` can be computed at compile-time.<br>
<br>
</span>(define-syntax (case* stx)<br>
(syntax-case stx ()<br>
[(_ what [v e ...] ...)<br>
(with-syntax ([(v* ...) (generate-temporaries #'(v ...))])<br>
#'(let-syntax ([foo (λ(_) (with-syntax ([(v* ...) (list v ...)])<br>
#'(case what [(v*) e ...] ...)))])<br>
foo))]))<br>
<br>
(case* 3<br>
[1 2]<br>
[(+ 1 2) 4])<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:<br>
<a href="http://barzilay.org/" target="_blank">http://barzilay.org/</a> Maze is Life!<br>
</font></span></blockquote></div><br></div>