Fractals in Lisp







Mandelbrot set using Asci graphic by Frank Buß :

(loop for y from -1 to 1.1 by 0.1 do
(loop for x from -2 to 1 by 0.04 do
(let* (
(c 126)
(z (complex x y))
(a z))
(loop while (< (abs(setq z (+ (* z z) a))) 2)
while (> (decf c) 32))
(princ (code-char c))))
(format t "~%")) ; stream t is a standard output




;creating a file
;definition of function based on code by Richard Socher
(defun writeToFile (f_name content)
(with-open-file
(stream f_name
:direction :output
:if-exists :overwrite
:if-does-not-exist :create )
(format stream content))
f_name)

; execution of function
(writeToFile a.txt "hello world")

; it saves text file a.txt with string Hello world" inside



Draw Mandel using ZPNG package  by Zach Beane

;
(asdf:oos 'asdf:load-op :asdf-install)
; install zpng
(asdf-install:install :zpng)
;load mandelbrot package
(load "/home/adam/zpng/zpng-1.2/doc/mandelbrot.lisp")
(in-package mandelbrot)
(compile 'draw-mandelbrot)
; run
(draw-mandelbrot "m.png")

(load "examples.lisp")
(in-package #:vecto-examples)
(gradient-example "b1.png")



Main page


Autor: Adam Majewski adammaj1-at-o2-dot--pl

Feel free to e-mail me. (:-))
About