<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">> Does… CL have a pattern-based macro syntax like syntax-rules? </span><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">Not buit-in.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">> If not, it seems surprising to argue that lisp macros would be easier to learn. Can you give examples?</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>The explanation of CL macros and their application in <a href="http://www.bookshelf.jp/texi/onlisp/onlisp.html">On Lisp</a> seems more accessible, for example, than anything I've been able to lay my hands on for the syntax-rules/case/parse.</div>
<div><br></div><div>Dan</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 22, 2014 at 10:28 AM, John Clements <span dir="ltr"><<a href="mailto:clements@brinckerhoff.org" target="_blank">clements@brinckerhoff.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><br>
On Mar 21, 2014, at 3:49 PM, Daniel Prager <<a href="mailto:daniel.a.prager@gmail.com">daniel.a.prager@gmail.com</a>> wrote:<br>
<br>
> Thank-you for raising this topic.<br>
><br>
> > I don't understand well its macros (are completely different for me than CL macros).<br>
><br>
> Me neither. And I'm somewhat torn. The trade-off as I understand it is that CL-style macros are *much* easier to learn, but prone to aliasing while hygenic macros are technically superior because they compose better and you can't accidentally hit aliasing problems. But when it comes to learning, the advantages are reversed.<br>
<br>
</div>Does… CL have a pattern-based macro syntax like syntax-rules? If not, it seems surprising to argue that lisp macros would be easier to learn. Can you give examples?<br>
<span class="HOEnZb"><font color="#888888"><br>
John Clements<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> William Byrd, in this 2012 interview with Michael Fogus, comments on some of these issues:<br>
> Clojure's macro system appears to me to be a kludge, trying to patch up Common Lisp's defmacro without going all the way to real hygienic macros. I don't mean to be overly critical--I'm not happy with the state of Scheme, either, which has not one but two hygienic macro systems, neither of which is ideal.<br>
><br>
> The more powerful Scheme macro system, syntax-case, gives the programmer the full power of Scheme at macro expansion time, along with the ability to "bend" hygiene when desired. Syntax-case is powerful enough to define Common Lisp's defmacro (and almost certainly powerful enough to define Clojure's defmacro as well). Unfortunately, syntax-caseis notoriously complicated. As far as I can tell, mastering syntax-case requires a mental model equivalent in complexity to the macro expander's implementation. As a result, Dan, Oleg, and I refuse to use syntax-case.<br>
><br>
> The other Scheme macro system, syntax-rules, is strictly less powerful than syntax-case, and can in fact be implemented in syntax-case. However, the mental model required to use syntax-rules is much simpler, as it is essentially a term-rewriting system with hygiene. For vanilla forms such as let, and, and or, syntax-rules works beautifully. For incredibly complicated macros, such as the match pattern matcher used in Kent Dybvig's compiler course at Indiana, the full power of syntax-case is probably required. For almost all other macros, it seems like a system with just a little more power than syntax-rules would be both sufficient and ideal. For example, often a macro writer wishes to concatenate two symbols--currently this requires using syntax-case, even if the rest of the macro is trivial.<br>
><br>
> If a hygienic macro system that hits the sweet spot between syntax-rules and syntax-caseis created, I hope it will be adopted by Schemers and Clojurers alike. A few steps in this direction include the Dylan macro system and Ryan Culpepper's syntax-parse. Also needed is a way to learn how to write non-trivial hygienic macros that doesn't involve earning a PhD in programming languages from Indiana or Northeastern.<br>
><br>
> The Racket and Scheme inner circle say that hygienic macros are the future, but I wonder whether a worse-is-better argument can be mounted for CL and/or Clojure macros.<br>
><br>
> Personally, I only write Racket macros sparingly, but would like to develop my level of understanding of comfort.<br>
><br>
> What are some good ways to smooth out the learning curve?<br>
><br>
><br>
> Dan<br>
><br>
><br>
><br>
> On Sat, Mar 22, 2014 at 12:42 AM, Matthias Felleisen <<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>> wrote:<br>
><br>
> Welcome.<br>
><br>
> Why don't you take a look at Greg's macro write-up<br>
><br>
> <a href="http://www.greghendershott.com/fear-of-macros/" target="_blank">http://www.greghendershott.com/fear-of-macros/</a><br>
><br>
> and see whether this helps you wrap your head around macros.<br>
><br>
><br>
><br>
><br>
> On Mar 21, 2014, at 9:48 AM, Alejandro Zamora Fonseca <<a href="mailto:terefv@ltu.sld.cu">terefv@ltu.sld.cu</a>> wrote:<br>
><br>
> > Hi!!<br>
> > My name is<br>
> > Alejandro, i'm a Cuban Computer Scientist, new to Lisp(having 1 year using CL), and wishing change to Racket.<br>
> > I see the list and I hope make me a better Lisp programmer with your kindly help.<br>
> ><br>
> > I have Racket installed in my PC, I like the language and tools, but yet I don't understand well its macros(are completely different for me than CL macros) and continuations.<br>
> ><br>
> > Greetings for all.<br>
> ><br>
> > Alejandro<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> ><br>
> > Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas<br>
> ><br>
> > Infomed: <a href="http://www.sld.cu/" target="_blank">http://www.sld.cu/</a><br>
> ><br>
> > ____________________<br>
> > Racket Users list:<br>
> > <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
><br>
><br>
> --<br>
> Daniel Prager<br>
> Agile/Lean Coaching, Software Development and Leadership<br>
> Startup: <a href="http://www.youpatch.com" target="_blank">www.youpatch.com</a><br>
> Twitter: @agilejitsu<br>
> Blog: <a href="http://agile-jitsu.blogspot.com" target="_blank">agile-jitsu.blogspot.com</a><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div style="font-family:arial;font-size:small"><b>Daniel Prager</b></div><div style="font-family:arial;font-size:small">Agile/Lean Coaching, Software Development and Leadership<br>
</div><div style="font-family:arial;font-size:small"><font color="#999999">Startup: </font><font color="#000000"><a href="http://www.youpatch.com" target="_blank">www.youpatch.com</a></font></div><div style="font-family:arial;font-size:small">
<font color="#999999">Twitter:</font> <a href="https://twitter.com/agilejitsu" style="color:rgb(17,85,204)" target="_blank">@agilejitsu</a> </div><div style="font-family:arial;font-size:small"><font color="#999999">Blog:</font> <a href="http://agile-jitsu.blogspot.com/" style="color:rgb(17,85,204)" target="_blank">agile-jitsu.blogspot.com</a></div>
</div>
</div>