On May 4, 2016, at 2:32 PM, Johannes <bra...@nordakademie.de> wrote:

> Is there any explanation for this behavior?

My understanding is that you can't eval function objects. Whatever you give to 
eval needs to be code that you could enter into the REPL. You couldn't type 
#function[user/fn--13335/f--13336] into the REPL and have it evaluate to that 
function. More to the point, the reader doesn't handle the function object 
represented by that string. For the same reason, you can't put function objects 
directly into code generated by macros.

That said, I've inadvertently given a function object to eval a few times, and 
*sometimes* it worked. I don't have an explanation for that. It actually caused 
me some confusion, because, since it worked the first time I tried it, I 
concluded with surprise and glee that you *can* eval function objects. But it's 
not true, at least not reliably. If you want to (reliably) make eval return 
something containing a function object, you need to give eval an expression 
containing a symbol or expression that evaluates to that function object—not 
the function object itself.

--
Ben Kovitz
http://mypage.iu.edu/~bkovitz/


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to