Equivalent to clojure.contrib's show?

元气小坏坏 提交于 2019-12-04 04:28:33

De-constructing show to be more "simple", making available distinct pieces of re-usable functionality, was discussed by Stuart Halloway in a talk he give on clojure simplicity.

The resulting code makes use of clojure.reflect/reflect and clojure.pprint/print-table and standard clojure filter:

(require 'clojure.reflect)
(require 'clojure.pprint)

(->> (clojure.reflect/reflect java.lang.String)
     :members
     (filter #(.startsWith (str (:name %)) "last"))
     (clojure.pprint/print-table))

I refer you to the Where Did Clojure.Contrib Go document, which says about clojure.contrib.repl-utils:

Migrated to clojure.repl and clojure.java.javadoc. show functionality similar to clojure.reflect/reflect.

The clojure.reflect API documentation is here, and the clojuredocs.org examples are here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!