<div dir="ltr">(let ([x y])<div> x)</div><div>=> y</div><div><br></div><div>That "let" is just a wrapper that equals y. So your macro is really</div><div><br></div><div>(define-syntax (mylet stx)</div><div> (syntax-case stx ()</div><div> [(_ x) #'x]</div><div> [(_ x xs ...) #'(cons x (mylet xs ...))])])</div><div><br></div><div>Which causes</div><div>(mylet 1 2 3) => '(1 2 . 3) ;don't forget the dot!</div><div><br></div><div>And that's just the macro version of a normal recursive function</div><div><br></div><div><div>(define (mylet . xs)</div><div> (match xs</div><div> [(list x) x]</div><div> [(list x xs ...) (cons x (apply mylet xs))]))</div></div><div><br></div><div>So nothing macro-y has really taken place. If you are attempting to redefine let, you'll have to place any binding forms inside of the output syntax, right of the sharp quote. The runtime code that the macro expands into has to bind something, in other words. Your original version binds a value during the expansion of the output code, where the output code is just the function I have above. I hope that makes sense.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 2, 2014 at 9:19 PM, Kevin Forchione <span dir="ltr"><<a href="mailto:lysseus@gmail.com" target="_blank">lysseus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi guys,<br>
Why does this appear to work? I assume it’s not a recommended approach.<br>
<br>
#lang racket<br>
<br>
(require (for-syntax syntax/parse))<br>
<br>
(define-syntax (mylet stx)<br>
(let ([val (syntax-case stx ()<br>
[(_ x) #'x]<br>
[(_ x xs ...) #'(cons x (mylet xs ...))])])<br>
val))<br>
<br>
(mylet 1 2 3) => ‘(1 2 3)<br>
<br>
-Kevin<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>