[email protected] writes:
> What am I missing here?
Functions don't really have names. A function may be bound to a var,
and that has a name (:name metadata, to be precise). That said, since
function's get compiled to classes you could twiddle with the class
name.
user> (defn fnname [f]
(symbol (clojure.string/replace-first (.getName (class f)) "$" "/")))
#'user/fnname
user> (let [f partition]
(fnname f))
clojure.core/partition
user> (let [f fnname]
(fnname f))
user/fnname
user> (let [f (fn [])]
(fnname f))
user/eval1301$f__1302
user> (let [foo (fn [])]
(fnname foo))
user/eval1327$foo__1328
user> (let [foo (fn bar [])]
(fnname foo))
user/eval1333$bar__1334
user> (letfn [(foobar [])]
(fnname foobar))
user/eval1371$foobar__1372
For what do you need that?
Bye,
Tassilo
--
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.