Normative Rules: Equality Predicates
← Prev | ↑ Chapter | Next → | Index | Symbols
Normative Rules: Equality Predicates
Statement
AutoLISP defines the following equality predicates with the semantics observed in BricsCAD V26 / macOS:
(eq a b)— pointer-level identity for cons cells, distinguishes freshly-allocated objects, but returnsTfor two textually-identical string literals (the host interns string literals), andTfor two textually-identical symbol literals (canonical case-folded name).(equal a b)— structural equality over cons cells; numerically compares an integer to a real ((equal 1 1.0)returnsT); compares strings by content.(= a b ...)/(/= a b ...)— value equality / inequality over numbers and strings only (not the any-type domain ofeq~/~equal): numbers compare by value across the integer/real tower ((= 1 1.0)returnsT), strings by content ((= "abc" "abc")returnsT). One-or-more-argument variadic form.(< a b ...)(<= a b ...)(> a b ...)(>= a b ...)— the relational family; same numbers-and-strings domain, with strings ordered lexicographically by character code point. Documented in full alongside this page as Function Entries in chapter 5 ("The Comparison Operators, /, <, <=, >, >=").- Domain / error rule for
=/=<<=>>=: genuinely incompatible non-nil argument types (a number against a string, e.g.(< 1 "a")) signal a type error; but any argument that isnilmakes the resultnilwithout error — bottom (⊥) propagation, consistent with chapter 4 ("Distinguished Object Entry: NIL"):(< 1 nil) = nil,(= nil nil) = nil. This is the sense in which they are more restrictive thaneq~/~equal, which accept any type. - Truthiness: a value is true iff it is not
nil.0,0.0,""are true.nilis the unique false value.
Vendor Evidence
BricsCAD V26 / macOS direct probe section H–J:
(equal "abc" "abc") = T;(eq "abc" "abc") = T— string literals are interned.(equal 1 1.0) = T— cross-type numeric equality.(equal '(1 2) (list 1 2)) = T;(eq '(1 2) (list 1 2)) = nil— structural vs identity.(= 1 1.0) = T— numeric cross-type equality via=.(= "abc" "abc") = T;(< "a" "b") = T—=and the relational operators compare strings (verified in BricsCAD V26).(< 1 nil) = nil;(< "abc" nil) = nil— anilargument returnsnil, not a type error (⊥ propagation).(if 0 'yes 'no) = YES;(if 0.0 'yes 'no) = YES;(if "" 'yes 'no) = YES;(if '() 'yes 'no) = NO.(eq nil '()) = T;(null nil) = T;(null '()) = T—niland the empty list are the same object.
Cross-references
- "The Comparison Operators
, /, <, <=, >, >=" and Function Entries=/=<<=>>=(chapter 5) — the per-operator definitions and the shared argument-type domain. - "Distinguished Object Entry: NIL" (chapter 4) — the bottom (⊥) reading that governs the
nil-argument exception. - Compare CLHS 14.5.1 — CL's
eqis finer-grained (does not intern strings). - Compare R7RS 6.1 — Scheme distinguishes
eqv?,eq?, andequal?.
Source Notes
Phase-6 BricsCAD V26 / macOS semantics probe sections H, I, J.