or, the dreaded "no matching ctor found" exception.

Is there a way to write the function

(defn eval-at-one [f] (eval `(~f 1)))

such that it works when invoked like this:

(eval-at-one (fn [x] x))
 ;; --> 1

and like this

(eval-at-one (with-meta (fn [x] x) {}))
 ;; -> IllegalArgumentException No matching ctor found for class
clojure.lang.AFunction$1  clojure.lang.Reflector.invokeConstructor
(Reflector.java:163)

?

I thought that the object returned by with-meta might be hanging onto the
original, metadata-less object, which could then be retrieved and used
without difficulty, but this appears not to be the case.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

-- 
-- 
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/groups/opt_out.

Reply via email to