Ben Godfrey

A slightly bigger Lisp program

I’ve been slowly reading On Lisp still and probably not picking much of it up because I haven’t really been able to think of anything to use as a testbed for code techniques.

I realised this was silly and decided to stay within the bounds of what I know and implement a simple web site engine of some kind, probably towards the CMS end of the spectrum, although we’ll see. For now I’ve created a teeny weeny script that uses two functions to facilitate the generation of valid CGI output. Check it out (feedback welcome).

I found just writing this taxing enough (it took about three hours to get to that point). I had to learn basic string manipulation and that involved learning how to learn about particular functionality rather than style. On Lisp is aimed more at people who can survive down in the trenches with Lisp already. I found the HyperSpec too far in the other direction and there’s little in between. Although the Common Lisp Cookbook is pretty useful.

Comments

Ladislav's avatar

Ladislav

That string manipulation stuff is nasty. Not your fault, it's just the kind of thing where infix notation shines. I notice the use of mapcar - that was pretty nice for the tag options. I use map and grep all the time in Perl and Python.

The CL cookbook looks pretty good: thanks for the link.

Cancel

Comments are closed for this post.

Ladislav's avatar

Ladislav

I probably exaggerated a bit there, but all that "concatenate string" stuff and the format calls seem a lot less convenient to me than Perl-style "<$tagname>$contents", and harder to maintain as well. You could probably write a macro to generate functions like a, h1, h2 etc.
Cancel

Comments are closed for this post.

Add a new comment

Comments are closed for this post.