dir-fn is a clojure.repl function for discovering a namespace’s public definitions. It returns those names as a sequence, making the result suitable for further processing instead of only displaying it. section 22.3 section 16.2
Use dir-fn when namespace contents need to be inspected programmatically:
- Require clojure.repl and pass a quoted namespace, because dir-fn is a function. section 22.3
- Receive an ordered sequence of public definitions declared in that namespace. section 22.3
- Prefer dir when direct REPL output is sufficient; dir prints the names rather than returning them for manipulation. section 22.3
Turn namespace definitions into a string
(require 'clojure.java.browse)\n(require '[clojure.repl :refer [dir-fn]])\n\n(apply str (interpose "," (dir-fn 'clojure.java.browse)))\n;; "*open-url-script*,browse-url"
