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.- 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.(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
- 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.