(= item1 item2 ...)


Return T if they're the same.


This function tells you whether two (or more) items are equal:

    • If they are equal, the result is a T (true).
    • If not, this function returns nil (false).

If the function contains more than two items, this function returns T (true) when each item to the right is equal to the item on its left. The items can be numbers or strings.

Examples

This expression Returns
(= 8 8) T
(= 10 10.0 10) T
(= "x" "y") nil
(= "door" "door") T
(= "door" "door" "door") T
(= 10) T

NOTES

    • Don't confuse the = function with the equal function. Here's the difference: The = function compares numbers and strings; the equal function compares lists.
    • Both = and equal perform comparisons; neither performs the "equals" function you might expect from arithmetic, such as 1 + 2 = 3. In LISP, that service is provided by the setq function.

Tell me about...

(/= item1 item2 ...)

(< item1 item2 ...)

(<= item1 item2 ...)

(> item1 item2 ...)

(>= item1 item2 ...)

(cond (statement1 result1 ...) ...)

(eq statement1 statement2)

(if test statement1 [statement2])

(while text statement )

LISP Compatibility

Programming Overview of LISP (LISt Processing) Language