(eq statement1 statement2)
Determine whether two expressions are bound to the same symbol.
This function determines whether two expressions are bound to the same symbol. If so, eq returns T; if not, eq returns nil.
Examples
Code | Comments |
---|---|
(setq s1 '(1 2 3)) | Create symbol s1. |
(setq s2 '(1 2 3)) | Create symbol s2. |
(setq s3 s2) | Bind s2 to s3. |
(eq s1 s3) | nil because s1 and s3 are not the same list. |
(eq s3 s2) | T because s3 and s2 are the same list. |
NOTE The eq function is not the same as the = (equal to operator) and equal(equal statement1 statement2 [tolerance])(IDR_166)functions. The = function returns T when two numbers or strings are equal. The equal function returns T when two expressions are equal. The eq function returns T when two expressions are bound to the same symbol.