Warning: this is just me musing and soliciting stimulating opinions. None of this may happen.
There should be one — and preferably only one — obvious way to do it
-- Tim Peters
;; try this form-by-form at a REPL | |
(require '[clojure.spec.alpha :as s]) | |
;; create an inline DSL to describe the FizzBuzz world | |
(defmacro divides-by | |
[nm n] | |
`(s/def ~nm (s/and pos-int? #(zero? (mod % ~n))))) | |
;; specify FizzBuzz | |
(divides-by ::fizz 3) |
;; Prints a table of vars in an ns with name/line/added/macro flag/deprecated flag | |
(defn pr-vars [ns-sym] | |
(->> (ns-publics ns-sym) vals (map meta) (sort-by :name) | |
(map #(select-keys % [:name :line :added :macro :deprecated])) | |
(map #(merge {:added nil :macro false :deprecated false} %)) | |
clojure.pprint/print-table)) | |
(pr-vars 'clojure.string) | |
;; | :added | :macro | :deprecated | :name | :line | |