On Oct 15, 2012, at 2:42 PM, Ben Smith-Mannschott wrote:
> 
> I think you're confusing:
> 
> (eval (list '(fn [x] x) 1))
> 
> with:
> 
> (eval (list (fn [x] x) 1))
> 
> In both cases, eval is being passed a list of two items. The first
> element of the list differs, however:
> 
> In the first case, it is a list beginning with the special form fn: a
> function literal that has not yet been evaluated. Eval will have no
> trouble with this.
> 
> In the second case it is a reference to an object implementing the
> clojure.lang.IFn interface. That's not a function literal, it's the
> result of evaluating one. This, as you've discovered, may or may not
> work with eval.
> 
> If the distinction I'm trying to make is not clear to you, I'd suggest
> having a look at http://www.infoq.com/presentations/Clojure-Macros (It
> does a good job exploring these kinds of distinctions as it's vital to
> have an accurate mental model of how Clojure is evaluated if one
> intends to write macros.)


Ah -- thanks Ben. You are right -- I was confused. FWIW the stuff that I 
sometimes do is:

 (let [value-function (eval (list 'fn '[x] individual))]
    .... bunch of stuff including a call to value-function on an input ...)

Yes, that's your first case, which the OPs example was not.

  -Lee

-- 
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