Clojure中的Java,评估问题

Clojure中的Java,评估问题,clojure,Clojure,是否对REPL上评估以下内容所获得的结果进行了详细解释 (.PI Math) 给予 当 (. Math PI) 评估为 3.141592653589793 解释在下面 (标识数学)返回表示数学类的类对象。您试图访问此类对象中名为PI的实例成员,但该成员不存在。(这不同于在Math类中访问名为PI的静态成员。)您只会使用此class对象进行反射,或将类作为对象传递给其他方法,或诸如此类的东西 user> (class (identity Math)) java.lang.Class u

是否对REPL上评估以下内容所获得的结果进行了详细解释

(.PI Math)
给予

(. Math PI)
评估为

3.141592653589793
解释在下面

(标识数学)
返回表示
数学
类的
对象。您试图访问此
对象中名为
PI
的实例成员,但该成员不存在。(这不同于在
Math
类中访问名为
PI
的静态成员。)您只会使用此
class
对象进行反射,或将类作为对象传递给其他方法,或诸如此类的东西

user> (class (identity Math))
java.lang.Class
user> (.getName (identity Math))
"java.lang.Math"
user> (.getName Math)
"java.lang.Math"
user> (.getMethods Math)
#<Method[] [Ljava.lang.reflect.Method;@12344e8>
user> (vec (.getMethods Math))
[#<Method public static int java.lang.Math.abs(int)> #<Method public static long java.lang.Math.abs(long)> #<Method public static float java.lang.Math.abs(float)> ...]
user> (.getField Math "PI")
#<Field public static final double java.lang.Math.PI>
user> (.getDouble (.getField Math "PI") Math)
3.141592653589793
user> (macroexpand '(.PI Math))
(. (clojure.core/identity Math) PI)
user> (class (identity Math))
java.lang.Class
user> (.getName (identity Math))
"java.lang.Math"
user> (.getName Math)
"java.lang.Math"
user> (.getMethods Math)
#<Method[] [Ljava.lang.reflect.Method;@12344e8>
user> (vec (.getMethods Math))
[#<Method public static int java.lang.Math.abs(int)> #<Method public static long java.lang.Math.abs(long)> #<Method public static float java.lang.Math.abs(float)> ...]
user> (.getField Math "PI")
#<Field public static final double java.lang.Math.PI>
user> (.getDouble (.getField Math "PI") Math)
3.141592653589793
user> (macroexpand '(Math/PI))
(. Math PI)
user> Math/PI
3.141592653589793
user> (. Math PI)
3.141592653589793