-
-
Save dschneider/3b8ffea29937fdf5ba00 to your computer and use it in GitHub Desktop.
Revisions
-
Dennis Schneider renamed this gist
Apr 7, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
vsmart revised this gist
Mar 31, 2015 . 2 changed files with 9 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ ;; This is a useful macro for clojure debugging (defmacro dbg[x] `(let [x# ~x] (println "dbg:" '~x "=" x#) x#)) ;; Use it anywhere in your expression like so: (defn factorial[n] (if (= n 0) 1 (* n (dbg (factorial (dec n)))))) ;; Taken from [stackoverflow](http://stackoverflow.com/a/2352280/789070) 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ -
vsmart created this gist
Mar 31, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ (defmacro dbg[x] `(let [x# ~x] (println "dbg:" '~x "=" x#) x#)) Use it anywhere in your expression like so: (defn factorial[n] (if (= n 0) 1 (* n (dbg (factorial (dec n)))))) Taken from [stackoverflow](http://stackoverflow.com/a/2352280/789070)