Created
May 11, 2015 14:26
-
-
Save jstaffans/adff4c9a4343b05bd214 to your computer and use it in GitHub Desktop.
assoc-time macro
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 assoc-time | |
"Evaluates expr and assocs the time it took in msecs with the result of expr." | |
[expr] | |
`(let [start# (System/currentTimeMillis) | |
ret# ~expr] | |
(assoc ret# :time (- (System/currentTimeMillis) start#)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment