Comparing Stuff: eq, equal, and More
There’s a lot of beautiful symmetry in Lisp. One part of Lisp that isn’t so beautiful, though, involves the commands for comparing things.
If you want to compare two values in Lisp to find out if they are “the same,” you will find a bewildering assortment of different functions that purport to accomplish this. Of these,
equalp are the most commonly used. A Lisper must understand the subtleties of these functions intimately in order to know how to compare values correctly.
Before we start dissecting this madness, let me give you Conrad’s Rule of Thumb for Comparing Stuff. Follow ...