Skip to content

Instantly share code, notes, and snippets.

@yokolet
Created March 30, 2014 01:50
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 yokolet/9866070 to your computer and use it in GitHub Desktop.
Save yokolet/9866070 to your computer and use it in GitHub Desktop.
Recursive call functions which raise java.lang.StackOverflowError
(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