Format: (eql <exp1> <exp2>)
Required arguments: 2
<exp1>: any LISP expression <exp2>: any LISP expression
Both argument expressions are evaluated. If they both return atoms, eql returns T if they are the same. If they return lists, eql returns T only if the lists are represented by the same object in memory. In contrast, two values can be ``equal'' if they are copies of one another (perhaps existing in different memory locations).
Examples:
> (eql 'hello 'hello) T > (eql -19 -19) T > (eql 2 3) NIL > (eql '(1 2 3) '(1 2 3)) NIL > (setq a '(1 2 3)) (1 2 3) > (setq b '(1 2 3)) (1 2 3) > (eql a b) NIL > (setq c a) (1 2 3) > (eql a c) T > (eql b c) NIL
Format: (equal <exp1> <exp2>)
Required arguments: 2
<exp1>: any LISP expression <exp2>: any LISP expression
Both argument expressions are evaluated. If the values returned are copies of one another (or even are physically the same by occupying the same memory), equal returns T. In contrast, for two lists to be eql they must represent the same object in memory.
Examples:
> (equal 'hey 'hello) NIL > (equal -81 -81) T > (equal '(1 (2 3)) '(1 (2 3))) T > (setq a '(1 2 3)) (1 2 3) > (setq b '(1 2 3)) (1 2 3) > (equal a b) T > (setq c a) (1 2 3) > (equal a c) T
© Colin Allen & Maneesh Dhagat