Adding Lisp to the mix

2007-12-29T12:17:17Z
Dave Pawson.  link
Home

Adding Lisp to the mix

Adding Lisp to the mix

Yesterday I spoke of comparing coding an algorithm in Java, Python and Ruby. Last night I lay there pondering that and wondered what it would be like in Lisp. David Tolpin likes it, as a language, Paul Graham likes it, so there must be something to it? Ten years ago I introduced myself to Schema for use in DSSSL. I was amazed by it... but quickly realized that it quickly grew difficult. Someone spoke of 'Easy to do easy stuff and can scale to more complex stuff'. Or something. I progressed to the easy stuff. Norms docbook DSSSL stylesheets had me stopped in my tracks. I bought Paul Grahams book on Common Lisp some time.... 2004 (do you write the purchase date in your books? I simply copied my fathers habit. I have a couple of his from ... 1941 (I even have a household accounts book from '43 which is fascinating)). I quickly realised why Scheme is seen as a pure Lisp dialect. Lisp is so much more pragmatic. I only spent a short time with it, again reading it for enjoyment rather than to do a job, a pre-requisite for me to study something.

As I said, I'd enjoyed comparing the languages for this purpose, so this morning I started a re-write in Lisp. Now this is fun!

I started with my test class (module? file? whatever the Lispers call it). I struggled a bit with the fprintf equivalent but found it in the end. I muttered about overloaded functions in Ruby and Python (used easily in Java) and found a mix in Lisp. It's minor nits in Lisp. I don't think it would be much hassle to code up for all the data types I've compared within one function.

Not being aware of the list of reserved words, I keep bumping into reserved words. I wanted substring, didn't like the numbering of subseq so wrote my own... only to find substring existed. No matter.

I started working in progn groups, then recalled the way in Scheme I used to build quite complex expressions gradually, making functions into parameters until I had what I wanted. This quickly reduced the sequential nature of my code and brought a smile to may face (OK, takes all sorts!)

I'm enjoying this!

Keywords: lisp

Comments (View)

Return to main index