78 lines
2.2 KiB
HTML
78 lines
2.2 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> Basic Data Types</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value=" Basic Data Types">
|
|
<meta name="keywords" value="lp">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR>
|
|
<A HREF="node5.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A>
|
|
<A HREF="node2.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A>
|
|
<A HREF="node3.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="node5.html"> Atoms</A>
|
|
<B>Up:</B>
|
|
<A HREF="node2.html"> LISt Processing</A>
|
|
<B> Previous:</B>
|
|
<A HREF="node3.html"> Background and Getting </A>
|
|
<BR> <HR> <P>
|
|
<H1> Basic Data Types</H1>
|
|
<P>
|
|
|
|
The two most important kinds of objects in Lisp for you to know about
|
|
are atoms and lists. These two kinds are mutually exclusive, with the
|
|
exception of one special entity, the empty list, known as ``()'' or
|
|
``nil,'' which is both an atom and a list. Atoms include symbols,
|
|
arrays, and various other data structures. For beginning purposes,
|
|
we'll restrict our attention to the subset of atoms that are
|
|
<em>symbols</em>.
|
|
|
|
<P>
|
|
Symbols are represented as sequences of characters of reasonable length.
|
|
<P>
|
|
Lists are recursively constructed from atoms. This means that a
|
|
given list may contain either atoms or other lists as members.
|
|
<P>
|
|
Examples:
|
|
<P>
|
|
<BLOCKQUOTE>
|
|
<PRE><TT>
|
|
SYMBOLS LISTS
|
|
<P>
|
|
a ()
|
|
<P>
|
|
john (a)
|
|
<P>
|
|
34 (a john 34 c3po)
|
|
<P>
|
|
c3po ((john 34) a ((c3po)))
|
|
<P>
|
|
</TT></PRE>
|
|
</BLOCKQUOTE>
|
|
<P>
|
|
|
|
<P>
|
|
Symbols and lists are both legal Lisp expressions for the interpreter
|
|
to read and evaluate. The rules for evaluating symbols and lists in
|
|
Lisp are very simple (one of the great beauties of the language).
|
|
They are covered in the next two sections.
|
|
<P>
|
|
<BR> <HR>
|
|
<UL>
|
|
<LI>
|
|
<A HREF="node5.html"> Atoms</A>
|
|
<LI>
|
|
<A HREF="node6.html"> Lists</A>
|
|
</UL>
|
|
<BR> <HR>
|
|
<P>
|
|
<ADDRESS>
|
|
<I>© Colin Allen & Maneesh Dhagat <BR>
|
|
March 2007 </I>
|
|
</ADDRESS>
|
|
</BODY>
|