Created
June 17, 2020 19:00
-
-
Save telekid/b0f4b230fcf49d2b0e7a778291511665 to your computer and use it in GitHub Desktop.
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
(defn hi [name] (println "hello " name)) | |
(s/def ::hi-args (s/cat :name string?)) | |
(def registry {`hi ::hi-args}) | |
(defn instrument [] | |
(s/check-asserts true) | |
(for [[sym spec] registry] | |
(alter-var-root (find-var sym) | |
(fn [f] | |
(fn [& args] | |
(s/assert spec args) | |
(apply f args)))))) | |
(instrument) | |
(hi 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment