Scheme Fractals

Using Scheme + MediaScript + GIMP I wrote a program that generates 1000[+] unique images. To achieve this variability, I rendered a fractal inspired by the Julia set, which is, itself, a variation of the Mandelbrot set. Overlayed on top of the Julia Set is a dragon fractal, as well as a grid and circles.

Download a 1280x1280 sized image similar to the second image in the slide show.

The Julia Set

To render a complex fractal such as the Julia Set, you define the x and y axis of an image as the real and complex parts of a complex number: a + bi ==> x + yi. Now, for each pixel in the image, you compute the Julia Set on the complex number formed from the x and y values of the pixel's position within the Cartesian coordinate plane implicitly formed by an image's grid of pixels.

Since the Julia Set is a recursive function and will compute forever, it must be capped. An easy way to do this is to keep track of the amount of recursions that happen before the fractal breaks out of some arbitrary boundary condition. The pixel is can then colored according to that number to achieve cool effects. Using a simple green to yellow gradient, the plain fractal looks like this:

yellow and green julia set

With an expressive language like Scheme, the code is rather concise:

(define julia!
  (lambda (n img . color-scheme)
    (let ((n_ (+ 0.3520 (* n 0.0002288)))
          (c-scheme (if (null? color-scheme) 
                        (lambda (n) 
                          (rgb-new (+ 120 n) (+ 70 (* 3 n)) (+ 80 (* 7 n))))
                        (car color-scheme))))
      (let* ((min_real (* n_ -2.0))
             (max_real n_)
             (min_imag (* n_ -1.2))
             (max_imag (+ (* (- n_ min_real) 
                             (/ (image-height img) (image-width img))) min_imag))
             (real_offset (/ (- max_real min_real) (decrement (image-width img))))
             (imag_offset (/ (- max_imag min_imag) (decrement (image-height img)))))
        (let ((calculate-set 
                (lambda (col row)
                  (let ((c_real (+ min_real (* col real_offset)))
                        (c_imag (- max_imag (* row imag_offset))))
                    (let seed ((Z_real c_real)
                               (Z_imag c_imag)
                               (n 0))
                      (if (or (> (+ (expt Z_real 2) (expt Z_imag 2)) 4) (= n 100))
                          (c-scheme n)
                          (seed (+ (- (expt Z_real 2) (expt Z_imag 2))
                                   Z_real Z_imag) n_) 
                                   (increment n))))))))
          (image-compute-pixels! img calculate-set)

Dragon Fractal

The second fractal is a dragon fractal. The dragon fractal is simpler in that it is not a complex fractal, rather, it can be created by "folding" lines. I render it using a variation on turtle graphics. Rather than a traditional turtle that simply colors the pixel it travels over, my custom turtle, a panda, passes the RGB value of the pixels it passes over to a user defined procedure (a one argument block) which can use that value to compute the RGB value it returns. The pixel's color is then set to the value returned by the block. This allows you to do coloring similar to the filters, such as overlay or inversion, that you find in any standard image manipulation program.

julia set with a dragon fractal overlayed

Scheme also allows a rather concise implementation:

(define dragoon!
  (lambda (panda n . diet)
    (let ((d 5))
      (when (not (null? diet)) 
        (panda ':set-diet! (car diet)) 
        (when (= (length diet) 2)
          (set! d (cadr diet))))
      (let dragon-egg ((n n)
                       (f #t))
        (if (= n 0)
            (panda-climb! panda d)
            (if f 
                ((lambda () 
                   (panda-look! panda 45)
                   (dragon-egg (decrement n) f)
                   (panda-look! panda -90)
                   (dragon-egg (decrement n) (not f))
                   (panda-look! panda 45)))
                ((lambda ()
                   (panda-look! panda -45)
                   (dragon-egg (decrement n) f)
                   (panda-look! panda 90)
                   (dragon-egg (decrement n) (not f))
                   (panda-look! panda -45)))


G-licious Splash

G-licious is a quick and easy way to check the Dining Menu in the Grinnell Dining Hall. You can check the menu for today, tomorrow, or any day in the next week as and when a new menu becomes available. G-licious also provides serving and nutritional information. G-licious is fully supported on iOS, Android, and Windows Phone and is optimized for both phone and tablet layouts.



After 12 years, the ACM award wining Tech Consultant Database: TCDB (originally UCDB) is due for an update. TCDB handles shift scheduling, time clocking, and employee management, and provides an employee directory and static information and announcement pages for the Grinnell College ITS Tech Consultant team. This project aims to duplicate the functionality of TCDB using a modern web framework, Ruby on Rails, while at the same time improving upon and expanding the original features and interface where prudent.

View TCDB2 on Github


jPearltrees is a Java library that provides an interface for handling the RDF/XML data exported from a Pearltrees account.

Pearltrees is an individually managed data-curation system with support for teams and collaboration. Pearltrees lets you organize categorical data into trees and provides convenient methods for further data cureation.

As the owner of all the data in your Pearltrees account, you can export your entire collection in an RDF/XML format. jPearltrees adapts the RDF/XML structure back into the natural tree structure and provides methods for accessing the data contained within a PearlTree.

jPearltrees is especially useful because it allows you to define a handler for the different pearls and then traverse the entire tree calling the respective callbacks each time a pearl is visited:

// Print a subtree..
PearlIterator pit = pt.listTreePearls();
while (pit.hasNext()) {
    // Access Pearl data
    Pearl p = pit.nextPearl
    System.out.println( p.getTitle() + 
                        " : " + 

    NoteIterator nit = p.getNotes();
// Use your own handler..
PearlHandler ph = new PearlHandler() {
    public onPearl(RootPearl rootPearl) {
        // Do Something with rootPearl..
    public onPearl(PagePearl pagePearl) {
        // Do something with pagePearl..
    public onPearl(AliasPearl aliasPearl) {
        // Do Something with aliasPearl..
    public onPearl(RefPearl refPearl) {
        // Do something with refPearl..

// Each Pearl passes itself to the handler's callback..
List<Pearl> treePearls = pt.getTreePearls();
for(Pearl pearl : treePearls) {

jPearltrees is available at:


One way of generating images is ray tracing (or casting). In ray tracing you define a scene of objects and you cast rays from the observer onto the scene. By using models for diffuse and reflective surfaces (such as the Phong model), and incorporating a basic refraction model, you can determine where light generated from both point and directional sources should be coming from when your casted rays collide with an object in the scene graph. The result is returned and a pixel is colored accordingly.

A simple scene may look like this: ray racer output

RayTracer is written in C++ and uses OpenGL for the display. Rendering, however, is done on the CPU. The casting of rays, Phong reflection, refraction, curve intersection, and generation of the image are all written from scratch.

You can view my implementation of a simple RayTracer on Github.


This package builds upon the Myro C++ package from the University of Tennessee at Knoxville to create a C-based library for connecting with Scribbler 2 robots. Using "extern C" interfaces, the Myro-C package compiles and runs in a standard C environment.

The Myro-C package supports a wide range of capabilities for the Scribbler 2 robot, controlled with C programs. The package also was developed to support a semester-long course introducing imperative problem solving and data structures at Grinnell College. Complete materials (syllabus, modules, readings, labs, and projects) are available at .

The source for this project is available on as MyroC

We also published and presented a paper among the proceedings of the ACM Special Interest Group in Computer Science Education conference in March of 2012 [SIGCSE 2012]. The paper is titled A C-Based Introductory Course Using Robots and is available on the ACM digital library.