



































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




































(+ 1 3 5) 9 (/ 3 5) 3/ (/ 3.0 5) 0. >(sqrt 4) 2
values
calls
of functions
(setq x 3.0)
x
(setq y x)
; the value of x is assigned as the value of y
y
(+ x y)
-. to force an evaluation, using function " eval "
Two more assignment functions: (set x y) ; assign the value of y to the value of x. x is evaluated ; first and whose value must be a symbol ; "setq" is a combination of "set" and "quote" (setf x y) ; similar to but more general than "setq" in that x can be ; something other than a symbol.
(quote x) x
'x x
(setq z 'x) x
(+ x z) Error: X is not of type NUMBER ...
(+ x (eval z))
2) Predicates (a special function which returns NIL if the predicate is false, T or anything other than NIL, otherwise) = , > , < , >= , <= for numerical values; equal, eq, for others (symbols, lists, etc.)
tests if x is a atom
tests if x is a list
also numberp, symbolp, null
(< x y) NIL
(= x y) T
(equal ‘x ‘y) NIL
(equal ‘a (car L)) T
(atom L) NIL
( listp x) NIL
( listp L) T
( atom x) T
(numberp ‘x) NIL
( atom ( car L)) T
(numberp x) T
(symbolp ‘ x) T
(symbolp x) NIL
handling