ACSL Lisp
ACSL Lisp
ACSL Lisp
Programming
The elements in the list, which are not lists, are called
atoms. For example, the atoms in the list above are: 23,
this, hello, 821, easy, and is.
Everything in LISP is either an atom or a list (but not both).
The only exception is NIL, which is both an atom and a
list. It can also be written as () a pair of parentheses
with nothing inside.
SET
We may assign values to variables using the
function SET. For example, the statement
(SET test 6) would have a value of a 6,
would also cause the atom test to be
bound to the atom 6.
The quote in front of the arguments indicates
that the arguments should not be evaluated
before the function is invoked.
The quote in front of numbers is optional.
Example Problems
Evaluate: (CDR ((2 (3))(4 (5 6) 7)))
The CDR function takes the first element of its
parameter (which is assumed to be a list) and
returns the modified list. The first element of the
list:
((2 (3))(4 (5 6) 7))
is
(2 (3)),
and the list without this element is
((4 (5 6 ) 7)).
(EXP
(EXP
(EXP
(EXP
(EXP
-216
(MULT
(MULT
(MULT
(MULT
6 3)