Skip to content

Instantly share code, notes, and snippets.

@PaulSandoz
Created November 2, 2011 12:50
Show Gist options
  • Save PaulSandoz/1333534 to your computer and use it in GitHub Desktop.
Save PaulSandoz/1333534 to your computer and use it in GitHub Desktop.
mandelbrot
(defn mandelbrot [^double cr ^double ci ^long limit]
(loop [rate limit
zr 0.0
zi 0.0]
(let [zr2 (* zr zr)
zi2 (* zi zi)]
(if (and (> rate 0) (< (+ zr2 zi2) 4.0))
(recur (dec rate) (+ cr (- zr2 zi2)) (+ ci (* 2.0 (* zr zi))) )
rate))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment