Hi Patrick,

yes, I think thats the right way to teach this stuff. My problem
arises earlier - I still have to motivate my collegues, to get them
interested, and, maybe, teach them later ;-)

Regards, alux

On 8 Sep., 16:28, CuppoJava <patrickli_2...@hotmail.com> wrote:
> I found the easiest way to introduce macros is just to introduce them
> as small syntactic sugaring. For example, getting rid of the explicit
> (fn [] ...) for macros like (with-open file ...).
> Once people get accustomed to this, they naturally extend it to more
> and more complicated usages.
>   -Patrick
>
> On Sep 8, 6:12 am, alux <alu...@googlemail.com> wrote:
>
> > Hello Joop,
>
> > thanks for the link. So it seems not to be completely misled ;-)
>
> > Greetings, alux
>
> > On 8 Sep., 11:59, Joop Kiefte <iko...@gmail.com> wrote:
>
> > > Actually, this metaphor has been used before. 
> > > Checkhttp://www.defmacro.org/ramblings/lisp.htmlforanother version of
> > > your story ;).
>
> > > 2010/9/8 alux <alu...@googlemail.com>:
>
> > > > Hello,
>
> > > > I still try to read my way through Paul Grahams "On Lisp", and always
> > > > think how to motivate this stuff to my fellow Java people. How do I
> > > > describe what it is all about in this "Code is Data", and "Macros let
> > > > you grow your own language towards the problem" stuff?
> > > > [Why? Well, maybe I read to much of Paul Grahams texts. So my current
> > > > working hypothesis is that this is the one big strength of Lisp that
> > > > other languages still dont have - so if I want to motivate people to
> > > > learn a Lisp, I have to at least point to it.]
>
> > > > Short answer: Difficult. ;-)
>
> > > > Especially if I find formulations like
> > > > "You can have the language which suits your program, even if it ends
> > > > up looking quite different from Lisp."
>
> > > > Longer Answer:
>
> > > > What puzzles me most about this quoted formulation is the words
> > > > "different from Lisp", as I know: All my Java collegues see
> > > > Lisp=Parentheses. So, to them, PGs formulation is even misleading. To
> > > > them it doesn't look quite different at the end.
>
> > > > Thus I try to come up with a metaphor, and I want to discuss it here,
> > > > in the hope I don't tell them rubbish at the end.
>
> > > > I want to liken XML to Lisp data. Then, with XSLT, some XML structures
> > > > are actually programs. Programs that work on XML data. The Lisp
> > > > parentheses are just like the basic XML syntax - elements, tags,
> > > > attributes. Obviousely Lisp has a much simpler syntax, but its trees
> > > > anyway. So XSLT can be likened to Lisp macros then.
>
> > > > And the use of it? Well, I currently want to talk to some people who
> > > > use Maven a lot. So the example I came up with is:
> > > > Think about when you had Ant, some years ago. Ant is just a
> > > > programming language for Java builds.
> > > > After a while you recognise that it'd be better to have something that
> > > > describes the project declaratively, with opinionated defaults. Well,
> > > > after some discussions you define something called pom.xml, that does
> > > > this (congratulation, we just invented Maven). Immediately you see
> > > > that all these Ant build scripts mentioned above could be generated
> > > > from this Maven pom.xml. So you might write XSLT to do so (this of
> > > > course deviates from historical truth). Some step later, you don't
> > > > generate them anymore as files; the only needed file is the pom.xml,
> > > > and the transformations of course.
>
> > > > So XML and XSLT are data and code, and they can do something that is
> > > > a) similar to what Lisp macros do, and
> > > > b) this is something my collegues understand.
>
> > > > Hopefully.
>
> > > > So, coming back to Paul Grahams quote, what the beginners see is: It
> > > > was XML and stays XML. The things "looking quite different" are, in
> > > > this metaphor, the XML schema of the Maven pom.xml versus the XML
> > > > scheme of the Ant files.
>
> > > > I hope that they will understand the power; and agree they will never
> > > > try and do this in XSLT. The Lisp syntax is just simple enough to be
> > > > usable for such tasks.
>
> > > > So, now you probably understand why I ask this question here, even if
> > > > it is a general Lisp question. This may be the only group where people
> > > > understand Lisp and Macros, XML/XSLT, and Ant, and Maven ;-)
>
> > > > Now the question:
> > > > Do you see any problems with this metaphor, is it misleading
> > > > somewhere?
>
> > > > Thank you, alux
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Clojure" group.
> > > > To post to this group, send email to clojure@googlegroups.com
> > > > Note that posts from new members are moderated - please be patient with 
> > > > your first post.
> > > > To unsubscribe from this group, send email to
> > > > clojure+unsubscr...@googlegroups.com
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/clojure?hl=en
>
> > > --
> > > Linux-user #496644 (http://counter.li.org) - first touch of linux in 2004
>
> > > Demandoj en aŭ pri Esperanto? Questions about Esperanto? Vragen over
> > > Esperanto? Perguntas sobre o Esperanto? -http://demandoj.tk

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to