Common Lisp - The Good, the Bad and the Ugly
Brit Butler
2011-11-04
(use arrow keys or PgUp/PgDown to move slides)
Preliminaries
It is LISP or Lisp? Well...
- It's a family of languages and ideas, a phenotype really, primarily distinguished by its 'code as data' philosophy these days.
- LISP could refer to older versions of the language,
first widely distributed version was LISP 1.5 circa 1963!
Could also refer to the family of languages/the genotype. - Lisp should be used when speaking about any modern incarnation. Need to use context to tell if subject is genotype or phenotype.
There are *modern* incarnations?
YES! Let's meet the fam...
- Scheme - Many implementations. R7RS upcoming, R6RS controversial.
- Clojure - New up-and-comer. Unusual, single author, opinionated. JVM-based.
- Common Lisp - A few implementations. Venerable, getting its act together.
So why CL over Clojure or Scheme?
A historical accident, I promise!
- The full R5RS Scheme Specification is under 50 pages. R7RS incoming.
NO MODULE SYSTEM but shifting towards being useful... - ANSI CL is 1100 pages and contains historical cruft.
But it has libraries, great implementations, community! - Clojure wasn't born when I started (2008).
Modern, elegant, functional, libraries. ... damn upstarts.
The real reason...
I've yet to find a hacking experience as pleasurable as CL+SLIME.
I pleasure hack in CL almost exclusively because the environment is just that nice. Unfortunately, there will be an (at best) crude demonstration of that. I'm mostly focused on just showing you guys the language today.
I hope to address image-based programming generally with live demonstration in Emacs and SLIME in a future talk.
A Few Fundamental Concepts
Only two things in Lisps: Atoms and Expressions.
Think simple substitution and reduction.
Special forms, Macros and everything else.
(see: clhs 3.1.2.1.2)
Code is data! () is the notation for a List. Much better than strings...
Once you get used to it. ;)
Related: We can switch back and forth between code and data via "quoting".
And now... SOME CODE!
Into cl-scrobbler ...
God...it's all so ugly!
Compared to Python? You better believe it.
Biggest problem right now is how to find libraries:
Unfortunate that newcomers faced with choice about compiler, editor.
At least we have quicklisp! Lispbox, further improvements incoming.
Resources for those interested...
- Friendly coworkers!
- Excellent books - PCL, CLtL, and the HyperSpec!
- Excellent implentations: Clozure CL, SBCL, and clisp
- Lovely package manager - Zach Beane's Quicklisp
- Great folks in freenode's #lisp. Just don't ask why you should learn it!
- Insane editor integration - SLIME for Emacs, Slimv for Vim.