Created
November 27, 2010 16:34
-
-
Save cathoderay/718042 to your computer and use it in GitHub Desktop.
modification of time (core) function to return the elapsed time in float, instead of formated string.
This file contains hidden or 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 my-time | |
"This is a construction above core 'time' function to | |
return the time elapsed as a float, instead of a formated string. | |
Usage example: (my-time + 2 1)" | |
[f & args] | |
(Float/parseFloat (first (re-find #"(\d+\.\d+)" (with-out-str (time (apply f args))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment