Skip to content

Commit

Permalink
(refactoring) better defn-timed
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Mar 23, 2015
1 parent 889d710 commit ec435d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/timing/core.clj
Expand Up @@ -59,9 +59,5 @@
(defmacro defn-timed
"def a fucntion which is born timed"
[name argvec & body]
(let [fname (gensym)
ns-qualified-name (str (ns-name *ns*) "/" name)]
`(do
(defn ~fname ~argvec ~@body)
(def ~name (timed-fn ~ns-qualified-name ~fname)))))

`(defn ~name ~argvec
(timed ~(str name) ~@body)))
1 change: 0 additions & 1 deletion test/timing/core_test.clj
Expand Up @@ -22,4 +22,3 @@
(deftest defn-timed-test
(let [t 1000]
(is (= t (demofunction2 t)))))

0 comments on commit ec435d2

Please sign in to comment.