Levi's Lisp Log

Thoughts and links relating to Lisp and computer theory

Markdown for Common Lisp

I've finally got my implementation of the Markdown text formatting language to a state where it's usable. It complies with almost all of the Markdown syntax specification, such as it is, and is comparable in execution time to the perl and python versions I tried it against.

It takes a string of Markdown-formatted text, processes it, and spits out an s-expression that can be fed into an HTML generator such as Peter Seibel's FOO (described here and part of this source package).

I'd be interested to get feedback on it; some bug-fixes, or suggestions for stylistic improvement would be appreciated. This is only my second Common Lisp program of any size, so it's bound to be sub-optimal. If you want to try it out or take a look at it, you can download it.

# Posted by: Levi at 12:09 AM on Friday, February 10, 2006
   Comments: (0) Categories: Lisp

A CS Reading List

I just came across a list of classic texts in Computer Science that seems to run the gamut of CS topics. They're mostly rather old, but still very relevant. I've already read a few of them, and those ones are indeed classic, so I'm excited to read the rest when I get a chance.

On the same site, there is also a list of the site author's favorite books, of which I own and have at least skimmed through most. I agree that they are great books.

Elsewhere, there are some lecture notes by Daniel Friedman describing applications of continuations that look to be an interesting read.

# Posted by: Levi at 12:42 PM on Tuesday, January 10, 2006
   Comments: (0) Categories: Programming History Scheme Lisp

Context-Oriented Lisp

Thanks to the extensive metaprogramming facilities in Common Lisp, it is often used as an experimental testbed for new programming paradigms. Recently, Pascal Costanza and Robert Hirschfeld have come up with a new form of program structuring called Context-Oriented Programming.

Roughly, the idea is to create different "layers" in the software that expose different portions of objects' interfaces. This allows for changes in behavior based on context rather than just the traditional mechanisms of subtyping and composition. I'd explain further myself, but Bill Clementson has created a tutorial based on the example in Costanza and Hirschfeld's paper that does a better job than I could.

If you'd like to try it out, the ContextL extension to Common Lisp can be found at the Closer Project site, along with additional information about ContextL and Common Lisp's Meta-Object Protocol, which made ContextL possible.

# Posted by: Levi at 1:39 PM on Tuesday, September 13, 2005
   Comments: (0) Categories: Lisp Language-design OOP

Dangers of Destructive Functions

While finishing up the templates for the site, I ran into a little problem--suddenly, each type of page would only render one set of entries despite instructions to the contrary. After a good bit of debugging (inspect is my friend), I found the culprit: nconc.

The html-template library requires passing in a plist to the template printer in order to fill template variables. Originally, everything in the plists was generated on-the-fly, so nconcing them together wasn't an issue. However, I ended up adding a static plist entry at the end of one plist-returning function, and the first nconc after a compile would append all sorts of entries to the end of that one, making them part of the static data as well.

Lesson learned: Start out with non-destructive functions, and only optimize to destructive versions when it is necessary and safe to do so!

# Posted by: Levi at 01:23 AM on Tuesday, September 13, 2005
   Comments: (0) Categories: Lisp

Blog Software Update

I've finally got the running server switched over to the new version of my Lisp blog software. It's been under development on and off for months now, but I finally feel it's featureful enough to let it live relatively safely on the net. It now supports comments, which is one reason I was delaying, so feel free to drop me a line and let me know what you think.

# Posted by: Levi at 01:06 AM on Tuesday, September 13, 2005
   Comments: (1) Categories: Lisp Blog