emacs.d/clones/lisp/colinallen.dnsalias.org/lp/node67.html

61 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> Funcall</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Funcall">
<meta name="keywords" value="lp">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<BR> <HR>
<A HREF="node68.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A>
<A HREF="node64.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A>
<A HREF="node66.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="node68.html"> Apply</A>
<B>Up:</B>
<A HREF="node64.html"> FunctionsLambda Expressions, </A>
<B> Previous:</B>
<A HREF="node66.html"> Lambda Expressions</A>
<BR> <HR> <P>
<H1>Funcall</H1>
<font size=-1><em>[Our thanks to <a href="mailto:remmers@jremmers.org">John H.
Remmers</a> for allowing his material from his <a
href="http://www.emunix.emich.edu/~remmers/337/lisp-functional-features.html">programming
languages course</a> to be incorporated into this section.]</em></font>
<p>
<TT>FUNCALL</TT> is similar to <TT>APPLY</TT>, except that the
function arguments are at the same level as the function description
instead of being in a sublist, as <TT>APPLY</TT> is typically used.
For example:
<BLOCKQUOTE>
<TT>
&gt; (FUNCALL '+ 3 5 9)<br>
17
</TT>
</BLOCKQUOTE>
In fact, the similarity is closer than this description indicates for
<BLOCKQUOTE><TT>(FUNCALL '+ 1 2 3)</TT></BLOCKQUOTE>
not only evaluates to the same result as
<BLOCKQUOTE><TT>(APPLY '+ '(1 2 3))</TT></BLOCKQUOTE>
but also to the same result as
<BLOCKQUOTE><TT>(APPLY '+ 1 2 3 nil)</TT></BLOCKQUOTE>
<BR> <HR>
<P>
<ADDRESS>
<I>&#169; Colin Allen, John H. Remmers, &amp; Maneesh Dhagat <BR>
March 2007 </I>
</ADDRESS>
</BODY>