Paul Graham's "On Lisp" has a nice little section on anaphoric macros.
It has a few nice tricks, but generally the Clojure style tends to
avoid them if possible. ie. using if-let instead of an anaphoric-if
macro.

Also, I think the book Rob was referring to is called "Let Over
Lambda" by Hoyte. As far as I know, he's only written one book.

  -Patrick

On Apr 12, 10:35 am, rob levy <[email protected]> wrote:
> Sometimes it is useful to have a referentially opaque symbol that you can
> refer to when calling a macro.  Clojure's design encourages the idiom of let
> bindings instead of anaphora to maintain referential transparency, but in
> some cases it is preferable to capture a symbol and make use of it.  If you
> are familiar with Perl, you know about the $_ anaphor.  In Lisps you can
> create things of that sort using macros.  For example you could define a
> simple macro you call as (aif foo (cons it lis)) where "it" seems to come
> out of nowhere but is in fact captured at macro-expansion time and in the
> expanded code this symbol is lexically bound to a value.
>
> On Tue, Apr 12, 2011 at 10:24 AM, Jeffrey Schwab <[email protected]>wrote:
>
>
>
> > On Tuesday, April 12, 2011 9:25:25 AM UTC-4, rob wrote:
>
> >>  One Scheme advocate I know has that suggested that it would be more
> >> hygienic to have gensyms be the rule instead of the exception to the rule
> >> (you could still get capture by asking to *not* gensym).  I'm not certain I
> >> agree with him, because I haven't fully considered if that would add or
> >> reduce complexity when trying to do things like anaphora (which is already
> >> made somewhat non-idiomatic).
>
> > What do you mean by "anaphora" in this context?  Could you please provide
> > an example in code?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to [email protected]
> > Note that posts from new members are moderated - please be patient with
> > your first post.
> > 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

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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