Skip to content

Instantly share code, notes, and snippets.

@mshroyer
Created March 31, 2011 07:32
Show Gist options
  • Save mshroyer/895962 to your computer and use it in GitHub Desktop.
Save mshroyer/895962 to your computer and use it in GitHub Desktop.
Mandelbrot fractal in Scheme
(define (p i c x)
(cond ((< i 1) "*")
((> (magnitude x) 2) " ")
(else (p (- i 1) c (+ (* x x) c)))))
(do ((y -1 (+ y .05))) ((> y 1))
(do ((x -2 (+ x .025))) ((> x 1))
(let ((c (make-rectangular x y)))
(display (p 99 c c))))
(newline))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment