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 <j...@schwabcenter.com>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 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 > -- 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