Python “dir” equivalent in Clojure

后端 未结 2 2004
囚心锁ツ
囚心锁ツ 2021-02-05 13:12

Does anybody know if there is a Clojure equivalent for Pythons \"dir\". Basically I need to know the functions I can call on something or more specifically for java objects I wa

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-05 14:00

    The clojure.repl namespace (which is available since Clojure 1.2) contains the macro dir and the function dir-fn:

    user=> (clojure.repl/dir clojure.main)   
    load-script
    main
    repl
    ...
    
    user=> (clojure.repl/dir-fn 'clojure.main)
    (load-script main repl repl-caught repl-exception 
     repl-prompt repl-read skip-if-eol skip-whitespace 
     with-bindings)
    

提交回复
热议问题