O'Reilly logo

Land of Lisp by Conrad Barski M.D.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, equal, eql, eq, =, string-equal, and 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.

image with no caption

Before we start dissecting this madness, let me give you Conrad’s Rule of Thumb for Comparing Stuff. Follow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required