(finally) working with Lisp

Several months ago I assigned my data structures students a little recursive puzzle as part of a somewhat longterm assignment. The assignment is due soon, and I thought I’d take some time to write up a solution in Lisp for my own enjoyment.

Now, I’ve been putzing around with Lisp for some time, but this is really the largest thing I’ve written outside of the Practical Common Lisp examples. To be fair, at 56 lines it’s not ‘large’ by any stretch of the imagination. Still, it’s been fun, and I’ve noticed some things.

Programming in SLIME is a pure joy. I find myself writing very short functions and testing them at the REPL repeatedly; Lisp really does facilitate bottom-up programming. Originally I thought this approach was more of a convention, but it turns out to be an emergent property of the language and programming environment. Functions without side-effects are quite easy to test, and SLIME lets you recompile and test at will. Though I think the mutable-state-objects so prevalent in Python really keep us from leveraging the power of the Python REPL, it might be worthwhile to encourage a Lispy-bottom-up approach in Python, too. Maybe some additional tools and a bit more dedication to this style are needed (it’s not the same emergent property as seen in Lisp itself), but the benefits would be worth it. Syntax and macros aside, the ability to tinker with the code I’m writing while I’m writing it is a huge win. Lisp makes this much simpler.

I’m going to think about this some more…I believe the ease of the REPL has pedagogical implications, too (I mean, where’s the Java REPL?).

Comments !