Skip to content

Instantly share code, notes, and snippets.

@dschneider
Forked from vsmart/gist:8deecda2be8fb3e6afa0
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save dschneider/3b8ffea29937fdf5ba00 to your computer and use it in GitHub Desktop.

Select an option

Save dschneider/3b8ffea29937fdf5ba00 to your computer and use it in GitHub Desktop.

Revisions

  1. Dennis Schneider renamed this gist Apr 7, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @vsmart vsmart revised this gist Mar 31, 2015. 2 changed files with 9 additions and 7 deletions.
    9 changes: 9 additions & 0 deletions gistfile1.clj
    Original 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)
    7 changes: 0 additions & 7 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +0,0 @@
    (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)
  3. @vsmart vsmart created this gist Mar 31, 2015.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original 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)