Lisp Basics

Lisp has a view notions of equality, like many languages.

From Common Lisp: Equality Predicates

(eq x y) is true if and only if x and y are the same identical object.

The eql predicate is true if its arguments are eq, or if they are numbers of the same type with the same value, or if they are character objects that represent the same character.

The equal predicate is true if its arguments are structurally similar (isomorphic) objects. A rough rule of thumb is that two objects are equal if and only if their printed representations are the same.

Two objects are equalp if they are equal; if they are characters and satisfy char-equal, which ignores alphabetic case and certain other attributes of characters; if they are numbers and have the same numerical value, even if they are of different types; or if they have components that are all equalp.

So eq is like == in Java. equal is more like the equals method.

LispBasics (last edited 2014-02-01 18:52:16 by DesmondRivet)