June 21st, 2010

A CL workbook

I am looking for a way to conveniently keep a session of Lisp interaction. For example, when I write down a problem and solution for class, I define a succession of variables with defparameter (or a slightly more convenient form I've defined). In a later year, if I give the problem again with different numbers, I just change the defining parameters, and recalculate. This is clumsy, but it mostly works. What I'd really like is to define a few input parameters, and stepwise calculate the intermediate quantities. A single defun isn't appropriate because I need the intermediate values to show to the students. The defparameter approach is tedious and prone to error.

What I envision is a structure or class instance with "given values" provided at the beginning, and steps consisting of the form and the value. A new instance of the same problem would have the same forms to evaluate, but different values. It might also be nice to branch, i.e., at some step in the calculation, continue with a different set of calculations. but still be able to keep the tree structure (kind of like git for Lisp forms? hmmm).

Is there anything like this (in any language) out there? I tried some googling but if there's something along these lines out there, I'm not using the right keywords. For lack of a better word, I'm calling it a Lisp workbook or notebook. Bonus if it will integrate with LaTeX and/or org-mode.