Mandelbrot for the terminal

From: Frank Buss (fb_at_frank-buss.de)
Date: 07/30/04


Date: Fri, 30 Jul 2004 21:39:05 +0000 (UTC)

Based on a Java program ( http://tinyurl.com/57smz ) I've implemented a
Lisp program for showing the Mandelbrot set:

  (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 "~%"))

I tried to make it as short as possible and it is some chars shorter than
the Java program, if written in one line without much spaces. With CLISP,
the program is only 4 times slower than the Java program. Nice result, I
didn't expect this with my unoptimized program and using complex variables.

-- 
Frank Buß, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de


Relevant Pages

  • Re: Mandelbrot for the terminal
    ... Edi Weitz writes: ... >> I tried to make it as short as possible and it is some chars shorter ... >> than the Java program, if written in one line without much ... Man, that's rad! ...
    (comp.lang.lisp)
  • Filtering data from a file
    ... I am currently trying to develop a java program that reads in data ... from a CSV file. ... file only showing RM01_01 and RM01_02. ... Any help in this matter would be highly appreicated. ...
    (comp.lang.java.help)