Skip to content

Instantly share code, notes, and snippets.

@telekid
Created June 17, 2020 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save telekid/b0f4b230fcf49d2b0e7a778291511665 to your computer and use it in GitHub Desktop.
Save telekid/b0f4b230fcf49d2b0e7a778291511665 to your computer and use it in GitHub Desktop.
(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