Go to the first, previous, next, last section, table of contents.


Lisp Lists

In Lisp, a list looks like this: '(rose violet daisy buttercup). This list is preceded by a single apostrophe. It could just as well be written as follows, which looks more like the kind of list you are likely to be familiar with:

'(rose 
  violet 
  daisy 
  buttercup)

The elements of this list are the names of the four different flowers, separated from each other by whitespace and surrounded by parentheses, like flowers in a field with a stone wall around them.

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


Go to the first, previous, next, last section, table of contents.