Maybe there should be a little more info regarding the syntax-quote
expansion algorithm for more involved situations, especially nested
backquotes. There seems to be just the bare minimum in the Reference
section. The rest is gathered in bits and pieces here and there.
Contrast this with the detailed explanation in the CL HyperSpec:

http://www.lispworks.com/documentation/HyperSpec/Body/02_df.htm

It would really be cool if Rich could give us the algorithm in a
similar way (case analysis).

For instance, in the case of nested syntax-quotes, which one gets
expanded first, the inner or the outer one? (just a simple example of
what I'm trying to say)

This is important I believe, because syntax-quotes are an essential
ingredient of macros, and macros are one of the most distinctive
features of Lisp, which set it apart from the rest. I agree that a
very effective way of learning is by trial and error, but it would be
nice to have these things documented precisely as well.

For a more general teatment, here's a good read:

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.5.2566


On Nov 20, 1:30 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Nov 20, 6:39 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > On 20 Nov., 11:29, Rock <[EMAIL PROTECTED]> wrote:
>
> > > I was what the difference might be with respect to this:
>
> > >  `(let [frame ~frame]
> > >    (.setTitle frame ~title)
> > >    (.setVisible frame)
> > >    frame)
>
> > This won't work, since - assuming you are in namespace
> > user - the backquote will expand to...
>
> > (let [user/frame (new JFrame)]
> >   (.setTitle user/frame "Sometitle")
> >   (.setVisible user/frame)
> >   user/frame)
>
> > ... and hence the let will complain, since you are not
> > allowed to use fully qualified symbols in a let form.
>
> > Hence you need ~'frame (capturing frame => bad) or
> > frame#/gensym (not capturing frame => good).
>
> Yes. Please use auto-gensyms (name#):
>
> `(let [frame# ~frame]
>    (.setTitle frame# ~title)
>    (.setVisible frame#)
>    frame#)
>
> ~' should be used for intentional capture only, i.e. rarely.
>
> That section of the Wiki should be re-worked, IMO.
>
> Rich
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to