1

I would expect (doc Math/exp) to give me something but it doesn't. Sure it's not a Clojure function, but still there should be some way to reach the documentation.

Closest thing that I can get is (javadoc Math). I would prefer the actual doc from that page as a string:

static double exp(double a)
Returns Euler's number e raised to the power of a double value.

UPD: signature by reflection

Here's how I can get a signature:

(.toString (first (filter #(= (.getName %) "exp") (.getMethods Math))))

I'm hoping for a similar way to get the doc.

UPD: no doc by reflection

According question How to read Javadoc comments by reflection?, it's not possible to get the doc by reflection. I wonder if it's possible to re-use some of Eclipse code that does give access to docs.

Community
  • 1
  • 1
abo-abo
  • 20,038
  • 3
  • 50
  • 71
  • 1
    Well, write that function! You have everything under your hands. – Chiron Jan 31 '14 at 15:36
  • ha-ha. No doubt that it's writable, but even in the best case I've got a hack that has to connect to internet and parse html to get the doc, instead of something solid that's available offline and is properly indexed. – abo-abo Jan 31 '14 at 15:44
  • You could also install the JDK sources, and parse their doc comments. Thinking of it, shouldn't be too difficult actually. Use the class name to find the file, and then to a little regexp trickery to find the function and extract `/** (.+?) */`. –  Jan 31 '14 at 16:11
  • OK, that's better than internet, but still. I'm no Java expert, but is it possible to get some doc via Java introspection/reflection? – abo-abo Jan 31 '14 at 16:14
  • See http://stackoverflow.com/questions/8504013/how-to-read-javadoc-comments-by-reflection – Dmitry Jan 31 '14 at 20:13
  • Seen it. It's already in the question:) – abo-abo Jan 31 '14 at 20:15

1 Answers1

0

Simply start typing the method name that you intend to use:

(java.lang.Math/exp)

and with the cursor on the "exp" , press M-.

See the CIDER docs for more related hotkeys https://cider.readthedocs.io/en/latest/interactive_programming/

If you also install "company-mode", then searching for the class you intend to use also gets easier via autocomplete.

Istvan Devai
  • 3,962
  • 23
  • 21