<p dir="ltr"><br>
On Mar 22, 2014 3:44 AM, "Daniel Prager" <<a href="mailto:daniel.a.prager@gmail.com">daniel.a.prager@gmail.com</a>> wrote:<br>
><br>
> > Does… CL have a pattern-based macro syntax like syntax-rules? <br>
><br>
> Not buit-in.<br>
><br>
> > If not, it seems surprising to argue that lisp macros would be easier to learn. Can you give examples?<br>
><br>
> The explanation of CL macros and their application in On Lisp seems more accessible, for example, than anything I've been able to lay my hands on for the syntax-rules/case/parse.</p>
<p dir="ltr">It has been mentioned already in this thread, but I think that Greg Hendershott's Fear of Macros tutorial is by far the best here: <br>
<br>
<a href="http://www.greghendershott.com/fear-of-macros/">http://www.greghendershott.com/fear-of-macros/</a></p>
<p dir="ltr">In particular, it doesn't start with pattern matching, which is part of what makes macros confusing to newcomers.</p>
<p dir="ltr">Sam</p>
<p dir="ltr">><br>
><br>
><br>
> On Sat, Mar 22, 2014 at 10:28 AM, John Clements <<a href="mailto:clements@brinckerhoff.org">clements@brinckerhoff.org</a>> wrote:<br>
>><br>
>><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>
>> 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>
>><br>
>> John Clements<br>
>><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/">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/">http://www.sld.cu/</a><br>
>> > ><br>
>> > > ____________________<br>
>> > > Racket Users list:<br>
>> > > <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br>
>> ><br>
>> ><br>
>> > ____________________<br>
>> > Racket Users list:<br>
>> > <a href="http://lists.racket-lang.org/users">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">www.youpatch.com</a><br>
>> > Twitter: @agilejitsu<br>
>> > Blog: <a href="http://agile-jitsu.blogspot.com">agile-jitsu.blogspot.com</a><br>
>> > ____________________<br>
>> > Racket Users list:<br>
>> > <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br>
>><br>
><br>
><br>
><br>
> -- <br>
> Daniel Prager<br>
> Agile/Lean Coaching, Software Development and Leadership<br>
> Startup: <a href="http://www.youpatch.com">www.youpatch.com</a><br>
> Twitter: @agilejitsu <br>
> Blog: <a href="http://agile-jitsu.blogspot.com">agile-jitsu.blogspot.com</a><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br>
><br>
</p>