Search code examples
clojureclojure-contrib

Equivalent to clojure.contrib's show?


There used to be this useful utility called show in clojure.contrib. Now, that it's deprecated, is there an equivalent to it?

Thanks!


Solution

  • 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))