February 10th, 2004

(no subject)

Another newbie was asking about intro Lisp books yesterday, and said something like "But Paul Graham says..." I made a joke about Paul Graham braindamage and Scheme braindamage, and someone else said that the only Scheme braindamage was assuming tail call elimination. That didn't seem quite right to me, so I made a list of my personal braindamage. Your damage may vary.

My first Scheme-related book was SICP, based on Philip Greenspun's raves. My first Common Lisp-related book was ANSI Common Lisp, which I picked up after reading The Other Road Ahead.

  • corrupting variable names that happened to be the same as function names (most frequently: writing lst instead of list). Why bother doing this? It's not like if I wanted to port the system to Scheme, the variable names would be the big roadblock.
  • trying to define functions (with defun) inside other functions to capture hidden shared state. actually tried to jump through bizarre hoops like:
    (setf (symbol-function 'foo) (lambda ...))
    
  • thinking that lisp is actually scheme with some historical crufty names (like "defun" and "setf" instead of "define", and "progn" instead of "begin")
    • this led me to avoid or ignore things that didn't have a schemy counterpart, which turns out to be rather a lot of useful Common Lisp stuff: format, extended loop form, structures, special variables, CLOS, streams, exceptions, etc
  • Curiously, I didn't avoid macros: I got the impression, from reading Paul Graham's books, that I would spend about half my time extending the language with macros and short convenience functions, and the other half writing applications. Since macros seemed more fun than actual applications, I wasted a lot of time writing macros and helper functions as soon as it looked like I needed them. Several times I wound up rewriting existing Common Lisp functions and macros, poorly, without being aware of them.