Skip to content

Commit 4335020

Browse files
committed
time macro
1 parent a6fb2f9 commit 4335020

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/clojure/core.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@
1515
(+ x 1))
1616

1717
(defn dec [x]
18-
(- x 1))
18+
(- x 1))
19+
20+
(defmacro time [expr]
21+
(list (quote let) [(quote start) (quote (System_nanotime)) (quote ret) expr]
22+
(quote (do
23+
(println (str "Elapsed time: " (_slash_ (- (System_nanotime) start) 1000000.0) " msecs"))
24+
ret))))

0 commit comments

Comments
 (0)