Last active
November 23, 2015 11:49
-
-
Save Bost/2188835a538ef3dc8796 to your computer and use it in GitHub Desktop.
clojure loop recur
This file contains 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 characters
(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