1.10 Summary
Learning Lisp is like climbing a hill in which the first part is the
steepest. You have now climbed the most difficult part; what remains
becomes easier as you progress onwards.
In summary,
- Lisp programs are made up of expressions, which are lists or single atoms.
- Lists are made up of zero or more atoms or inner lists, separated by whitespace and
surrounded by parentheses. A list can be empty.
- Atoms are multi-character symbols, like
forward-paragraph
, single
character symbols like +
, strings of characters between double
quotation marks, or numbers.
- A number evaluates to itself.
- A string between double quotes also evaluates to itself.
- When you evaluate a symbol by itself, its value is returned.
- When you evaluate a list, the Lisp interpreter looks at the first symbol
in the list and then at the function definition bound to that symbol.
Then the instructions in the function definition are carried out.
- A single-quote ‘'’ tells the Lisp interpreter that it should
return the following expression as written, and not evaluate it as it
would if the quote were not there.
- Arguments are the information passed to a function. The arguments to a
function are computed by evaluating the rest of the elements of the list
of which the function is the first element.
- A function always returns a value when it is evaluated (unless it gets
an error); in addition, it may also carry out some action that is a
side effect. In many cases, a function’s primary purpose is to
create a side effect.