Created
November 2, 2011 12:50
-
-
Save PaulSandoz/1333534 to your computer and use it in GitHub Desktop.
mandelbrot
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
(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