Node:Numbers Lists, Next:Lisp Atoms, Previous:Lisp Lists, Up:Lisp Lists
Lists can also have numbers in them, as in this list: (+ 2 2)
.
This list has a plus-sign, +
, followed by two 2
s, each
separated by whitespace.
In Lisp, both data and programs are represented the same way; that is,
they are both lists of words, numbers, or other lists, separated by
whitespace and surrounded by parentheses. (Since a program looks like
data, one program may easily serve as data for another; this is a very
powerful feature of Lisp.) (Incidentally, these two parenthetical
remarks are not Lisp lists, because they contain ;
and
.
as punctuation marks.)
Here is another list, this time with a list inside of it:
'(this list has (a list inside of it))
The components of this list are the words this
, list
,
has
, and the list (a list inside of it)
. The interior
list is made up of the words a
, list
, inside
,
of
, it
.