-
-
Save amalloy/c93c37345c49c47dcfa2 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
(defmacro ? | |
"A useful debugging tool when you can't figure out what's going on: | |
wrap a form with ?, and the form will be printed alongside | |
its result. The result will still be passed along." | |
[val] | |
`(let [x# ~val] | |
(prn '~val '~'is x#) | |
x#)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right. And I also tend to rewrite such a little function, since it's even easier than trying to remember in what clojure contrib it lives, grab the dependency if I don't have it yet ... such a little function could maybe have its place somewhere in clojure core ? clojure.core, or clojure.repl ?