115 lines
2.6 KiB
HTML
115 lines
2.6 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
||
|
<!Originally converted to HTML using LaTeX2HTML 95 (Thu Jan 19 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
||
|
<HEAD>
|
||
|
<TITLE> eql, equal (PREDICATES)</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" eql, equal (PREDICATES)">
|
||
|
<meta name="keywords" value="lp">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<BR> <HR>
|
||
|
<A HREF="node93.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A>
|
||
|
<A HREF="node72.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A>
|
||
|
<A HREF="node91.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <BR>
|
||
|
<A HREF="lp.html"><B>Contents</B></A>
|
||
|
<B> Next:</B>
|
||
|
<A HREF="node93.html"> eval (FUNCTION)</A>
|
||
|
<B>Up:</B>
|
||
|
<A HREF="node72.html"> Appendix: Selected Lisp </A>
|
||
|
<B> Previous:</B>
|
||
|
<A HREF="node91.html"> documentation (FUNCTION)</A>
|
||
|
<BR> <HR> <P>
|
||
|
<H1> eql, equal (PREDICATES)</H1>
|
||
|
<P>
|
||
|
<b> Format:</b>
|
||
|
<tt> (eql <exp1> <exp2> )</tt>
|
||
|
<P>
|
||
|
<b> Required arguments:</b>
|
||
|
2
|
||
|
<P>
|
||
|
<tt> <exp1> </tt>: any Lisp expression
|
||
|
<tt> <exp2> </tt>: any Lisp expression
|
||
|
<P>
|
||
|
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).
|
||
|
<P>
|
||
|
<b> Examples:</b>
|
||
|
<P>
|
||
|
<BLOCKQUOTE>
|
||
|
<PRE>> (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
|
||
|
</PRE>
|
||
|
</BLOCKQUOTE>
|
||
|
|
||
|
<P>
|
||
|
<b> Format:</b>
|
||
|
<tt> (equal <exp1> <exp2> )</tt>
|
||
|
<P>
|
||
|
<b> Required arguments:</b>
|
||
|
2
|
||
|
<P>
|
||
|
<tt> <exp1> </tt>: any Lisp expression
|
||
|
<tt> <exp2> </tt>: any Lisp expression
|
||
|
<P>
|
||
|
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.
|
||
|
<P>
|
||
|
<b> Examples:</b>
|
||
|
<P>
|
||
|
<BLOCKQUOTE>
|
||
|
<PRE>> (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
|
||
|
</PRE>
|
||
|
</BLOCKQUOTE>
|
||
|
<P>
|
||
|
<BR> <HR>
|
||
|
<P>
|
||
|
<ADDRESS>
|
||
|
<I>© Colin Allen & Maneesh Dhagat <BR>
|
||
|
March 2007 </I>
|
||
|
</ADDRESS>
|
||
|
</BODY>
|