next up previous
Contents Next: Atoms Up: LISt Processing Previous: Background and Getting

Basic Data Types

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 symbols.

Symbols are represented as sequences of characters of reasonable length.

Lists are recursively constructed from atoms. This means that a given list may contain either atoms or other lists as members.

Examples:


SYMBOLS			 LISTS

a ()

john (a)

34 (a john 34 c3po)

c3po ((john 34) a ((c3po)))

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.





© Colin Allen & Maneesh Dhagat
March 2007