1
0
Fork 0
cl-sites/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node56.html
2023-10-25 11:23:21 +02:00

74 lines
4.4 KiB
HTML

<!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>5.1. Forms</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Forms">
<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=tex2html2210 HREF="node57.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2208 HREF="node55.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2202 HREF="node55.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2212 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2213 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html2211 HREF="node57.html"> Self-Evaluating Forms</A>
<B>Up:</B> <A NAME=tex2html2209 HREF="node55.html"> Program Structure</A>
<B> Previous:</B> <A NAME=tex2html2203 HREF="node55.html"> Program Structure</A>
<HR> <P>
<H1><A NAME=SECTION00910000000000000000>5.1. Forms</A></H1>
<P>
The standard unit of interaction with a Common Lisp implementation is the <i>form</i>,
which is simply a data object meant to be <i>evaluated</i> as a program
to produce one or more <i>values</i> (which are also data objects).
One may request evaluation of <i>any</i> data object, but only certain ones
are meaningful. For instance,
symbols and lists are meaningful forms, while arrays
normally are not. Examples of meaningful forms are <tt>3</tt>,
whose value is <tt>3</tt>, and <tt>(+ 3 4)</tt>, whose value is <tt>7</tt>.
We write <tt>3</tt> => <tt>3</tt> and <tt>(+ 3 4)</tt> => <tt>7</tt>
to indicate these facts. (=> means ``evaluates to.'')
<P>
Meaningful forms may be divided into three categories:
self-evaluating forms, such as numbers; symbols, which stand
for variables; and lists. The lists in turn may be divided
into three categories: special forms, macro calls, and function calls.
<P>
<img align=bottom alt="old_change_begin" src="gif/old_change_begin.gif"><br>
Any Common Lisp data object not explicitly defined here to be a valid form
is not a valid form. It is an error to evaluate
anything but a valid form.
<P>
<hr>
<b>Implementation note:</b> An implementation is free to make
implementation-dependent extensions to the evaluator but is
strongly encouraged to signal an error on any attempt to
evaluate anything but a valid form or an object for which
a meaningful evaluation extension has been purposely defined.
<hr>
<br><img align=bottom alt="old_change_end" src="gif/old_change_end.gif">
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
X3J13 voted in October 1988 (EVAL-OTHER) <A NAME=2968>&#160;</A> to specify that
<i>all</i> standard Common Lisp data objects other than symbols
and lists (including <tt>defstruct</tt> structures defined
without the <tt>:type</tt> option) are self-evaluating.
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<HR>
<UL>
<LI> <A NAME=tex2html2214 HREF="node57.html#SECTION00911000000000000000"> Self-Evaluating Forms</A>
<LI> <A NAME=tex2html2215 HREF="node58.html#SECTION00912000000000000000"> Variables</A>
<LI> <A NAME=tex2html2216 HREF="node59.html#SECTION00913000000000000000"> Special Forms</A>
<LI> <A NAME=tex2html2217 HREF="node60.html#SECTION00914000000000000000"> Macros</A>
<LI> <A NAME=tex2html2218 HREF="node61.html#SECTION00915000000000000000"> Function Calls</A>
</UL>
<BR> <HR><A NAME=tex2html2210 HREF="node57.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2208 HREF="node55.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2202 HREF="node55.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2212 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2213 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html2211 HREF="node57.html"> Self-Evaluating Forms</A>
<B>Up:</B> <A NAME=tex2html2209 HREF="node55.html"> Program Structure</A>
<B> Previous:</B> <A NAME=tex2html2203 HREF="node55.html"> Program Structure</A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>