Skip to content

Instantly share code, notes, and snippets.

@mwmitchell
Created August 5, 2011 17:02
Show Gist options
  • Save mwmitchell/1127985 to your computer and use it in GitHub Desktop.
Save mwmitchell/1127985 to your computer and use it in GitHub Desktop.
simple clojure
(defn counter []
(let [x (atom 0)]
(fn [] (swap! x #(+ % 1)) @x)))
(let [c (counter)]
(prn (c))
(prn (c))
(prn (c)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment