Code Select
;newLISP v.10.0.0
;on Win32 IPv4 UTF-8
(import "kernel32.dll" "GetTickCount")
(set 'BAILOUT 16)
(set 'MAX_ITERATIONS 1000)
(define (iterate x y)
(let ((cr (sub y 0.5))
(ci x)
(zi 0.0)
(zr 0.0)
(i 0))
(while 1
(inc i 1)
(set 'temp (mul zr zi))
(set 'zr2 (mul zr zr))
(set 'zi2 (mul zi zi))
(set 'zr (add cr (sub zr2 zi2)))
(set 'zi (add temp temp ci))
(if (> (add zi2 zr2) BAILOUT)
(throw i))
(if (> i MAX_ITERATIONS)
(throw 0)))))
(define (mandelbrot)
(let ((t (GetTickCount)))
(for (y -39 38)
(for (x -39 38)
(set 'j (catch (iterate (div x 40.0) (div y 40.0))))
(if (= j 0.0)
(print "*")
(print " ")))
(print "n"))
(println "Time Elapsed: " (- (GetTickCount) t))))
(mandelbrot)