Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created January 31, 2011 22:18
Show Gist options
  • Save amalloy/c93c37345c49c47dcfa2 to your computer and use it in GitHub Desktop.
Save amalloy/c93c37345c49c47dcfa2 to your computer and use it in GitHub Desktop.
(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#))
@laurentpetit
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment