Variables For local variables, use let: (let ((var1 expr1) .... (varn exprn)) body) > (let ((x 1) (y 2)) (+ x y)) 3 A let expression has two parts: a list of instructions of form (var expr) and a body - a set of expressions evaluated in order. For global variables use defparameter or defvar: > (defparameter *g* 9) g Suggestion: To avoid confusion between local and global variables, the names of global variables should be surrounded by * Defining constants: defconstant: > (defconstant l (+ *g* 1)) Asigning values to variables: setf: > (let ((x 1)) (setf x 2) x) 2 > (setf *g* 10) 10 When the first argument is a symbol that is not a variable name, it is considered a global variable: > (setf x (list 'a 'b)) (A B) The first argument can be an expression: > (setf (car x) 'n) N > x (N B) Asignation in the body of a function: (defun foo (x) (setf x 10)) will not affect the variable outside the function (call by value, not by reference). Incrementing/decrementing values of variables: (incf x) <=> (setf x (+ x 1)) (decf x) (incf x 10) Other useful macros: rotatef: interchanges the values of two variables: (rotatef x y) <=> (let ((tmp x)) (setf x y y tmp) nil) shiftf: (shiftf x y 10) <=> (let ((tmp x)) (setf x y y 10) tmp)