Two convenience function for clojure.tools.trace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Two convenience function for clojure.tools.trace | |
(defn var-traceable? | |
"Predicate that returns whether a var is traceable or not." | |
[v] | |
(and (var? v) (ifn? @v) (-> v meta :macro not))) | |
(defn var-traced? | |
"Predicate that returns whether a var is currently being traced." | |
([ns s] | |
(var-traced? (ns-resolve ns s))) | |
([v] | |
(let [v (if (var? v) v (resolve v))] | |
(not (nil? ((meta v) ::clojure.tools.trace/traced)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment