std-equalp | ![]() |
Weakest comparison predicate if the two expressions are the same. Weaker than EQUAL, EQ and =.
std-equalp with two numbers or number-lists (see std-number-list-p) compare the numbers with a numeric tolerance of *NUM-TOL*. *NUM-TOL* defaults to 1E-6 (=0.000001) and is defined in STDMATH.
std-equalp with two list arguments, which are no number-lists, is true if both "sets" contain the same elements regardless of the order of the elements and duplicates. It calls STD-SET-EQUAL-P if both arguments are such lists.
STD-EQUALP with two string arguments is true if the uppercase string equivalents are equal.
All other cases are compared with EQUAL.
STD-EQUALP is also included for future expansions, to compare higher data structures, such as arrays, vectors, structures and hash tables.
(std-equalp 1 1.001) => T
if (<= *NUM-TOL* 1e-3)
(std-equalp (list (+ 1 1e-8) 2 3) '(1 2 3))
(<= *NUM-TOL* 1e-8)
=> T
(std-equalp '(a b c) '(c a b)) => T (std-equalp "test" "Test") => T
It's rarely used, only for inaccurate number-lists such as points. For case-insensitive string comparisons exists a special, faster comparison std-string-equal. and for sets exists the faster STD-SET-EQUAL-P.
See the table of equality operators
An important implication and restriction is that sets cannot be numbers only!
Number lists are compared with a numeric tolerance but the order must be preservered and no duplicate elements are allowed, which is different to sets. Number lists such as points are considered more important that sets.
Sets may be easily compared with STD-SET-EQUAL-P instead in which numbered sets are allowed.
expr1, expr2: any valid lisp expression
T or nil.
None.
(std-require 'STDLISP)
Defined in STDLISP