Skip to content

Instantly share code, notes, and snippets.

@Bost
Last active November 23, 2015 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bost/2188835a538ef3dc8796 to your computer and use it in GitHub Desktop.
Save Bost/2188835a538ef3dc8796 to your computer and use it in GitHub Desktop.
clojure loop recur
(loop [r 0
break false]
(if-not break
(if (< r 5)
(do
(println "Expensive calculation of r:" r)
(recur (inc r) false))
(do
(println "Breaking the loop at:" r)
(recur r true)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment