67 lines
1.9 KiB
HTML
67 lines
1.9 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> if (SPECIAL FORM)</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" if (SPECIAL FORM)">
|
||
|
<meta name="keywords" value="lp">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<BR> <HR>
|
||
|
<A HREF="node97.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="node95.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="node97.html"> length (FUNCTION)</A>
|
||
|
<B>Up:</B>
|
||
|
<A HREF="node72.html"> Appendix: Selected Lisp </A>
|
||
|
<B> Previous:</B>
|
||
|
<A HREF="node95.html"> first (FUNCTION)</A>
|
||
|
<BR> <HR> <P>
|
||
|
<H1> if (SPECIAL FORM)</H1>
|
||
|
<P>
|
||
|
<b> Format:</b>
|
||
|
<tt> (if <test> </tt>
|
||
|
<tt> <then> </tt>
|
||
|
<tt> <else> )</tt>
|
||
|
<P>
|
||
|
<b> Required arguments:</b>
|
||
|
2
|
||
|
<P>
|
||
|
<tt> <test> </tt>: any Lisp expression
|
||
|
<tt> <then> </tt>: any Lisp expression
|
||
|
<P>
|
||
|
<b> Optional arguments:</b>
|
||
|
1
|
||
|
<P>
|
||
|
<tt> <else> </tt>: any Lisp expression
|
||
|
<P>
|
||
|
The <tt> <test> </tt> expression is evaluated; if it returns a value other than NIL, if returns the result of evaluating the <tt> <then> </tt> expression. If <tt> <test> </tt> evaluates to NIL, and no <tt> <else> </tt> expression is provided, NIL is returned. Otherwise the result of evaluating <tt> <else> </tt>is returned.
|
||
|
<P>
|
||
|
<b> Examples:</b>
|
||
|
<P>
|
||
|
<BLOCKQUOTE>
|
||
|
<PRE>> (if (> 4 3) 4 3)
|
||
|
4
|
||
|
|
||
|
> (if (< 4 3)
|
||
|
(- 4 3)
|
||
|
(- 3 4))
|
||
|
-1
|
||
|
|
||
|
> (if (= 4 3) t)
|
||
|
NIL
|
||
|
</PRE>
|
||
|
</BLOCKQUOTE>
|
||
|
<P>
|
||
|
<BR> <HR>
|
||
|
<P>
|
||
|
<ADDRESS>
|
||
|
<I>© Colin Allen & Maneesh Dhagat <BR>
|
||
|
March 2007 </I>
|
||
|
</ADDRESS>
|
||
|
</BODY>
|