Created
March 30, 2014 01:50
-
-
Save yokolet/9866070 to your computer and use it in GitHub Desktop.
Recursive call functions which raise java.lang.StackOverflowError
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
(declare incrementor decrementor) | |
(defn incrementor [n] | |
(let [_ (print (str n ", ")) | |
next-val (+ n (rand-int 100))] | |
(if (< -10000 next-val) | |
(decrementor next-val)))) | |
(defn decrementor [n] | |
(let [_ (print (str n ", ")) | |
next-val (- n (rand-int 100))] | |
(if (> 10000 next-val) | |
(incrementor next-val)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment