The Path to Enlightenment is Littered With Parentheses

Adam Gomaa got quite a ways down the path of Lisp enlightenment, but has been turned off by the tedium of working with his SBCL implementation. He has difficulty with “packaging, setting up an environment, and debugging on the fly” and also with “setf, setq and all of the defvar variants.”

On my end, I’d say that working through the first sections of Shapiro’s CL:AIA got me fairly fluent in using packages. However, for the small projects I tend to tinker with on the side, I don’t find myself wanting to use packages much outside of Shapiro’s exercises. (Working inside packages other than CL-USER fattens up my symbols with a package prefix, I’ve noticed.)  As to setting up an environment, Lispbox on Windows takes most of the pain out of it… and setting up Clisp with Emacs has not proven to be that difficult on Cygwin or Linux even for me. My debugging skills are pretty weak though: I generally just hit the number that corresponds to Abort whenever there’s a problem.

Setq and Setf are no big deal. Setq is a specialized setter for working with symbols. (And remember that symbols aren’t just variables… but are really objects with quite a few properties of their own.) Setf works with anything. For instance, suppose you’re storing a list in a symbol. You could use Setq to set the symbol to be equal to the list you want to work with. And you could use Setf to work with the actual cars and cdrs that make up the list. (Actually, you can ignore the difference between these two most of the time and just use Setf for both purposes.)

Defparameter and Defvar have a similar subtle and ignorable difference. Defparameter is used to set a global variable to a new value. Defvar does the same thing– but only if thevariable does not already have a value! That’s a pretty finicky difference there, and if you’re using Defvar on purpose, you’re probably a lot smarter than me.  (If I’m working out some code, I generally like to be 100% sure about the program state before I start running any routines.) So really you don’t have to worry about these differences unless you’re trying something fancy and you can generally get away with just using Setf and Defparameter.

Given the lack of any recent Lisp posts on Adam’s blog, it appears that the Lisp community has lost yet another neophyte to the swelling ranks of Python advocates. Hopefully he will at least continue hacking away from Emacs. 😉


One Response to “The Path to Enlightenment is Littered With Parentheses”

  1. AdamG Says:

    I am indeed still working in Emacs! I’ve stepped back from CL to try and learn the basics (thoroughly, this time) by going through SICP with Scheme, and my lack of posts on is is mostly just a reflection of how much I’m finding I still have to learn.

    I do plan to post my answers for the exercises to each chapter as I complete them, but I’m still solidly stumped by chapter 1. 😀

    But yes, I am working in Python for most ‘practical’ software ATM. Python is quick to learn and I’m newer at programming than I’ll admit (though I don’t think it’s too hard to tell :), but I do aim to learn CL thoroughly… at some point.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: