I wanted to write a function like this:

(defn fn-name-info
  "Given a function, try to deduce the function name and clojure namespace 
by looking 
  at the function's java class name and decoding stuff.  Return a vector of 
name, namespace strings, 
  or nil if we can't find anything.
  
  For example, if in jdt.core we do (defn foo []), the resulting value foo 
is a thing whose class is
  jdt.core$foo, for which we can return [\"jdt.core\" \"foo\"].
  
  However, for anonymous functions like (fn []) typed into the REPL, 
  you're going to get something like [\"jdt.core\" \"eval3676$fn__3677\"]"
  [f]
  )

Surely someone out there has a bit of code that knows how to decode 
classnames accounting for
many of the weird edge cases, question marks (e.g. "QMARK"), and so on?

Can anybody help me out?

FYI, the next step I had planned for this was for me to reach take that fn 
information, look for the var that defines it, and yank out some metadata, 
when all I have is the function pointer, not the var.

Tips appreciated.

Yes, I know it's probably a bad idea for a couple of reasons, but feel free 
to point them out.


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