Avi Drucker / Jun 04 2021
Remix of Clojure by Nextjournal
CLJ Complexity Study 1.1
My goal here is to convert a function in a given namespace to simple a list of symbols/tokens. I understand that I could do this by saving my function to a file, and then reading out the text. Before doing this, I'd like to understand the following:
Is saving a function a file to then read the text back to a list in data simply convention? Most efficient? Simplest? Or something else?
Is converting a function to a list of individual tokens possible within a single namespace w/ the core Clojure libraries and w/o using external files or libraries?
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
;; complient is used for autocompletion
;; add your libs here (and restart the runtime to pick up changes)
compliment/compliment {:mvn/version "0.3.9"}
org.clojure/tools.namespace {:mvn/version "1.1.0"}
}}
deps.edn
Extensible Data Notation
{:hello (clojure-version)}
0.1s
Clojure
(defn cool [] (println "Hi there!"))
0.1s
Clojure
(def snippet2 cool)
0.0s
Clojure
*ns*
0.5s
Clojure
(require [clojure.tools.namespace.find :as find])
;; note: parse has been deprecated
2.5s
Clojure
(find.deps-from-ns-decl user)
0.6s
Clojure
;; (ns-map user)
0.2s
Clojure
(ns-map snippet2)
0.6s
Clojure
user/snippet2
0.0s
Clojure