In one section of the book, it explains that we can easily use function show in clojure.contrib.repl.utils to display document of Java library but that was for Clojure.
According to Where Did Clojure.Contrib Go, show moved to clojure.reflect/reflect. Let play with it a little bit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.reflect :as cr]) | |
(cr/reflect java.lang.Math) | |
;{:bases #{java.lang.Object}, :flags #{:public :final}, :me .... | |
; If you want to list all the method names of given class do | |
(map :name (:members (cr/reflect java.lang.Math))) | |
;(round nextUp nextUp exp min cos acos max hypot ceil ulp ulp min floor | |
;cbrt getExponent IEEEremainder log10 min rint tanh copySign | |
;negativeZeroDoubleBits max sin negativeZeroFloatBits E max PI expm1 | |
;cosh toDegrees signum signum sinh pow initRNG max round log | |
;randomNumberGenerator atan sqrt toRadians abs nextAfter getExponent | |
;scalb tan nextAfter random scalb java.lang.Math log1p min copySign | |
;atan2 abs abs abs asin) |
Note: you also can open Javadoc in browser with this snippet
(javadoc java.lang.Math)
No comments:
Post a Comment