Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
eq
Type: |
- |
predicate function (subr) |
Source: |
- |
xllist.c, xlsubr.c |
Syntax
- (eq expr1 expr2)
- exprN - arbitrary Lisp expressions
returns - T if the expressions
eveluate to the same internal value, NIL
otherwise
Description
Two expressions are 'eq' if the expressions are identical. The 'eq'
function tests if the results of the evaluated expressions point to
the same memory location. T is returned if
both expressions evaluate to exactly the same internal value,
NIL is returned otherwise.
Integer numbers being = are
'eq' as long as not stored in a CPU register, so the
eql function is recommended for testing integers. Also
note that arrays, floating-point numbers, lists, and strings
are only 'eq' if they are bound as variable values to the same symbol.
Examples
(eq 'a 'a) => T
(eq 1 1) => T or NIL
(eq 1 1.0) => NIL
(eq 1.0 1.0) => NIL
(eq "a" "a") => NIL
(eq '(a b) '(a b)) => NIL
(eq 'a 34) => NIL
(setq a '(a b)) ; set value of A to (A B)
(setq b a) ; set B to point to A's value
(setq c '(a b)) ; set value of C to different (A B)
(eq a b) => T
(eq a c) => NIL
See also eql, equal,
cl:equalp.
Back to Top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference