有谁知道Python 的“dir”是否有Clojure 等效项。基本上我需要知道我可以调用的函数,或者更具体地说,对于 java 对象,我想知道可用的方法和属性(我不确定在 java 中它们是否被称为方法和属性,这是 C# 术语)。
clojure.contrib.repl-utils/show
用于 REPL:
user=> (use '[clojure.contrib.repl-utils :only (show)])
nil
user=> (show String)
=== public final java.lang.String ===
[ 0] static CASE_INSENSITIVE_ORDER : Comparator
[ 1] static copyValueOf : String (char[])
[ 2] static copyValueOf : String (char[],int,int)
[ 3] static format : String (Locale,String,Object[])
[ 4] static format : String (String,Object[])
...
或者,也许是这样的:
user=> (map #(.getName %) (.getMethods String))
("equals" "toString" "hashCode" "compareTo" ...)
.getFields
, and .getConstructors
因此。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)