public
Created

Two convenience function for clojure.tools.trace

  • Download Gist
trace-predicates.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
;; 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))))))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.