Common Lisp; my thoughts & a review
Aug. 13th, 2011 09:10 pmI've been using Common Lisp fairly seriously for about a year or so, and recently I've rewritten part of my Master's thesis project in Common Lisp (from Ruby).
How is it?
The parens rapidly become not an issue. Maybe it's a personal thing, but the very regular syntax frees me to think about my semantics. Some people seem to favor irregular syntax. I don't personally understand that; forgetting semicolons, commas, or other elements is a common screwup in other languages for me. Lisp takes that away. Regular syntax (instead of wondering what the right Thungus is to put There) makes things better. Maybe this would be less of an issue if I didn't have so many languages floating in my head; I have used Perl, Python, Ruby, Bash, Lisp, and Make in serious fashion in the past year; I'm going to be learning Objective C and Haskell in the next year.
The library situation is pretty much as good as Perl or Python. Xach's Quicklisp serves quite well in this regard, and I expect it to be the comprehensive Lisp archive for the next decade. Lisp's fully dynamic nature allows redefinition of functions and reloading of modules, which is totally awesome. I'm not sure what other languages support that. Perhaps Erlang?
Macros have made my code shorter and better maintainable. I have almost no repetitive blobs of code. What I do have, I *could* rewrite, but would sacrifice clarity. I have had bugs with my macros, which have not been wholly obvious at first. You definitely need to open up your cleverness to debug them. What is fully evident is that a master Lisper can do portable things with macros that in other languages, require the compiler writers to implement.
The lack of a mainstream-sized community is something I feel. I participate in Stackoverflow and Reddit's Lisp areas, as well as read comp.lang.lisp, and there are generally only may be 5-10 regulars, which are shared between all 3 elements. The IRC channel is pretty good though, although it's infested with "Do it Right The First Time" people, like a parody of the "Worse is Worse" essay at times.
Sequences are put together in a 'so-so' fashion. There are vectors, and there are lists, and functions are not clear which type they take (and they might take both). I expect there's a library that manages this, but I haven't searched for it, preferring to learn the language from the ground up.
The FORMAT (Lisp's printf) function is crufty and weird.
LOOP works, after a fashion, and is unquestionably one of the weakest parts of the standard; I expect I shall investigate other iteration macros after the thesis is finished. Possibly the ITERATE library...
I haven't used any database connectors yet, so I can't comment on them.
Lisp shares the Image model with Smalltalk; this is a model where the REPL persists over a long time. Python and Ruby have their interactive mode, which (as they implement it) is a weaker version. So a common deployment strategy is to deploy a Lisp executable together with an image to be loaded into Lisp at run-time. That's pretty off-the wall compared to the Algol-derived world which has a hard line between compilation & application.
In terms of speed, Common Lisp is a bit slower than C++ for heavy computation - in the hands of an expert. This is in stark contrast with other dynamic languages, which usually are a joke for heavy in-language computation and require a C extension.
Typing is weird - I think it's close to Perl 5's typing - and I don't have 100% of a handle on how to write explicitly-typed code. Usually it's done in an optimization context.
Integration with the shell is "okay", and really requires external libraries to fully handle cleanly. I have put together a few functions which are pretty sweet for that.
In general, Common Lisp usually works like a language that's been designed, instead of organically grown with weird and annoying gaps in it. In this, it works like the C++ STL or the C stdio.
How is it?
The parens rapidly become not an issue. Maybe it's a personal thing, but the very regular syntax frees me to think about my semantics. Some people seem to favor irregular syntax. I don't personally understand that; forgetting semicolons, commas, or other elements is a common screwup in other languages for me. Lisp takes that away. Regular syntax (instead of wondering what the right Thungus is to put There) makes things better. Maybe this would be less of an issue if I didn't have so many languages floating in my head; I have used Perl, Python, Ruby, Bash, Lisp, and Make in serious fashion in the past year; I'm going to be learning Objective C and Haskell in the next year.
The library situation is pretty much as good as Perl or Python. Xach's Quicklisp serves quite well in this regard, and I expect it to be the comprehensive Lisp archive for the next decade. Lisp's fully dynamic nature allows redefinition of functions and reloading of modules, which is totally awesome. I'm not sure what other languages support that. Perhaps Erlang?
Macros have made my code shorter and better maintainable. I have almost no repetitive blobs of code. What I do have, I *could* rewrite, but would sacrifice clarity. I have had bugs with my macros, which have not been wholly obvious at first. You definitely need to open up your cleverness to debug them. What is fully evident is that a master Lisper can do portable things with macros that in other languages, require the compiler writers to implement.
The lack of a mainstream-sized community is something I feel. I participate in Stackoverflow and Reddit's Lisp areas, as well as read comp.lang.lisp, and there are generally only may be 5-10 regulars, which are shared between all 3 elements. The IRC channel is pretty good though, although it's infested with "Do it Right The First Time" people, like a parody of the "Worse is Worse" essay at times.
Sequences are put together in a 'so-so' fashion. There are vectors, and there are lists, and functions are not clear which type they take (and they might take both). I expect there's a library that manages this, but I haven't searched for it, preferring to learn the language from the ground up.
The FORMAT (Lisp's printf) function is crufty and weird.
LOOP works, after a fashion, and is unquestionably one of the weakest parts of the standard; I expect I shall investigate other iteration macros after the thesis is finished. Possibly the ITERATE library...
I haven't used any database connectors yet, so I can't comment on them.
Lisp shares the Image model with Smalltalk; this is a model where the REPL persists over a long time. Python and Ruby have their interactive mode, which (as they implement it) is a weaker version. So a common deployment strategy is to deploy a Lisp executable together with an image to be loaded into Lisp at run-time. That's pretty off-the wall compared to the Algol-derived world which has a hard line between compilation & application.
In terms of speed, Common Lisp is a bit slower than C++ for heavy computation - in the hands of an expert. This is in stark contrast with other dynamic languages, which usually are a joke for heavy in-language computation and require a C extension.
Typing is weird - I think it's close to Perl 5's typing - and I don't have 100% of a handle on how to write explicitly-typed code. Usually it's done in an optimization context.
Integration with the shell is "okay", and really requires external libraries to fully handle cleanly. I have put together a few functions which are pretty sweet for that.
In general, Common Lisp usually works like a language that's been designed, instead of organically grown with weird and annoying gaps in it. In this, it works like the C++ STL or the C stdio.