1
0
Fork 0
cl-sites/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node234.html

57 lines
2.7 KiB
HTML
Raw Normal View History

2023-10-25 11:23:21 +02:00
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>25.5. Identity Function</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Identity Function">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html4478 HREF="node235.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4476 HREF="node223.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4472 HREF="node233.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4480 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4481 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4479 HREF="node235.html"> Loop</A>
<B>Up:</B> <A NAME=tex2html4477 HREF="node223.html"> Miscellaneous Features</A>
<B> Previous:</B> <A NAME=tex2html4473 HREF="node233.html"> Other Environment Inquiries</A>
<HR> <P>
<H1><A NAME=SECTION002950000000000000000>25.5. Identity Function</A></H1>
<P>
This function is occasionally useful as an argument to
other functions that require functions as arguments. (Got that?)
<P>
<BR><b>[Function]</b><BR>
<tt>identity <i>object</i></tt><P>The <i>object</i> is returned as the value of <tt>identity</tt>.
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
The <tt>identity</tt> function is the default value for the <tt>:key</tt>
argument to many sequence functions (see chapter <A HREF="node141.html#KSEQUE">14</A>).
<P>
Table <A HREF="node129.html#IDENTITYPLOT">12-1</A> illustrates the behavior in the complex plane
of the
<tt>identity</tt> function regarded as a function of a complex numerical argument.
<P>
Many other constructs in Common Lisp have the behavior of <tt>identity</tt>
when given a single argument. For example, one might well use <tt>values</tt>
in place of <tt>identity</tt>. However, writing <tt>values</tt> of a single
argument conventionally indicates that the argument form might deliver
multiple values and that the intent is to pass on only the first of
those values.
<P>
<hr>
<b>Compatibility note:</b> In Maclisp, <tt>progn</tt> was a function of any number of arguments that
returned its last argument,
so <tt>progn</tt> could be used as an identity function.
In Common Lisp, <tt>progn</tt> is a special form and therefore cannot be used for
that purpose.
<hr>
<P>
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>