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 any type, never a type error: numbers compare by value across the integer/real tower ((= 1 1.0)returnsT), strings by content ((= "abc" "abc")returnsT), anything else by identity likeeq((= 'a 'a)and(= nil nil)returnT;(= 1 "1")returnsnil). Adjacent pairs, left to right:(/= 1 2 1)returnsT.(< a b ...)(<= a b ...)(> a b ...)(>= a b ...)— the relational family over numbers and strings, with strings ordered lexicographically by character code point andnilas the smallest value ((< nil 1)returnsT,(< 1 nil)returnsnil). Any other pair of non-nilarguments — a number against a string, a symbol, a list — signals a type error. Documented in full alongside this page as Function Entries in chapter 5 ("The Comparison Operators, /, <, <=, >, >=").- All six: at least one argument (none is an error, one returns
T); adjacent pairs compared left to right, stopping at the first false pair. - 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— no type error for anilargument.
AutoCAD 2022 (French, Windows) and BricsCAD V25 (Windows) / V26 (macOS), comparison-operators probe, 2026-09-25 (240 observations, 237 identical across the vendors):
(= 1 "1") = nil;(= 'a 'a) = T;(= nil nil) = T;(= (list 1 2) (list 1 2)) = nil—=never signals; identity for non-numbers/non-strings.(/= 1 2 1) = T— adjacent pairs.(< nil 1) = T;(<= nil nil) = T;(> "a" nil) = T—nilis the smallest value.(< 1 "a"),(< 'a 'b)— type error.(<)— error;(< 'a) = T.(>= 'a nil),(> nil 1 "a"),(>= nil 1 "a")— AutoCADT,nil,nil; BricsCAD type error (AutoCAD adopted).(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.