~amtunlimited/mandelbrot-plot

b7390ca9fbd3aaf58922f6bb2ccb0f2e6eb0ab37 — Aaron Tagliaboschi 2 years ago c9d19a0
packages and asdf, oh my!
7 files changed, 44 insertions(+), 15 deletions(-)

A README.md
A make-plot.lisp
A mandelbrot-plot.asd
M mandelbrot.lisp
A packages.lisp
D plot-test.lisp
M plot.lisp
A README.md => README.md +10 -0
@@ 0,0 1,10 @@
# Mandelbrot Plot
*...you're a Rorschach ~~test~~ plot on fire*

Just a simple render of the Mandelbrot set, done in ascii as apparently that's
how it was first viewed.

To run, load (or `--script`) `make-plot.lisp`, which will use asdf to make a build everything. `mandelbrot.out` is a copy of the output.


Made and tested on SBCL 1.4.16.debian
\ No newline at end of file

A make-plot.lisp => make-plot.lisp +7 -0
@@ 0,0 1,7 @@
(in-package "COMMON-LISP-USER")

(require 'asdf)

(load "mandelbrot-plot.asd")
(asdf:load-system :mandelbrot-plot)
(dev.aarontag.mandelbrot-plot:mandelbrot-plot)
\ No newline at end of file

A mandelbrot-plot.asd => mandelbrot-plot.asd +10 -0
@@ 0,0 1,10 @@
(defpackage :mandelbrot-plot-asd
  (:use :cl :asdf))

(in-package :mandelbrot-plot-asd)

(defsystem :mandelbrot-plot
  :serial t
  :components ((:file "packages")
               (:file "plot")
               (:file "mandelbrot")))
\ No newline at end of file

M mandelbrot.lisp => mandelbrot.lisp +5 -4
@@ 1,4 1,4 @@
(load "plot.lisp")
(in-package :dev.aarontag.mandelbrot-plot)

(defun mag (c)
  (let ((r (realpart c)) (i (imagpart c)))


@@ 23,6 23,7 @@


;;; TODO: maybe find interesting edges
(plot #'mandelbrot-xy
      (range 0.5 :start -2.0 :inc 0.05)
      (range 1.1 :start -1.1 :inc 0.05))
(defun mandelbrot-plot () 
      (plot #'mandelbrot-xy
        (range 0.5 :start -2.0 :inc 0.05)
        (range 1.1 :start -1.1 :inc 0.05)))

A packages.lisp => packages.lisp +10 -0
@@ 0,0 1,10 @@
(in-package "COMMON-LISP-USER")

(defpackage :dev.aarontag.simple-plot
  (:use :common-lisp)
  (:export :range :plot))

(defpackage :dev.aarontag.mandelbrot-plot
  (:use :dev.aarontag.simple-plot
        :common-lisp)
  (:export :mandelbrot-plot))

D plot-test.lisp => plot-test.lisp +0 -11
@@ 1,11 0,0 @@
(load "plot.lisp")

(defun sq (x) (* x x))

(defun in-circle (x y) 
  (>= 1
      (sqrt (+ (sq x)
               (sq y)))))

(let ((coord (range 1.0 :start -1.0 :inc 0.05)))
  (plot #'in-circle coord coord))

M plot.lisp => plot.lisp +2 -0
@@ 1,3 1,5 @@
(in-package :dev.aarontag.simple-plot)

;;;; Dead simple printed plots

;;; utility to make a range of numbers