Major differences between Common Lisp and Scheme

Major syntactical differences

Major non-syntactical differences

Namespaces

Lisp has two namespaces, one for regular values and one for functional values. This means that the same symbol can have two different values in the two namespaces, as shown in this example (not that this is a good example to follow...):
;; list here is a parameter
(defun print-squares (list)
  ;; list here is again a parameter
  (dolist (element list)
	  ;; but here it is a function
	  (print (list 
		  element 
		  (expt element 2)))))
Default choice of the namespace. When Lisp is given a list as a form to evaluate, if the first symbol in the list is not a special form or a macro. Lisp assumes it is the name of a function, and, consequently, uses its value in the functional namespace. For everything else Lisp uses the regular value.

Exceptions to the default choice of the namespace. Whenever the default choice of namespace is not appropriate we need to tell Lisp to select the other namespace. We do it in the following way:

For more examples, look at examples of generators.

So, to repeat briefly how to select a namespace which it not the one used by default:

Functions to access components of a symbol

There are various functions to access the values of a symbol in the two namespaces and other components of a symbol: and to access other components of a symbol, such as

Scope and Extent

Lisp variables have lexical scope (the same as in Scheme) and indefinite extent, but there are a few exceptions. Let's start with the definitions of scope and extent.

Definition of scope

Scope defines what parts of a program can reference an entity.

Definition of extent

Extent refers to the lifetime of an entity relative to the part of the program that establishes the entity.
;;; USING THE LEXICAL SCOPE AND INDEFINITE EXTENT TO CREATE A VARIABLE
;;; THAT BEHAVES LIKE A GLOBAL VARIABLE BUT CAN BE ACCESSED ONLY IN A
;;; CONTROLLED WAY
;;; this create a local variable, counter, whichis shared by a group 
;;; of functions.
;;; This allows multiple functions to operate on the same variable which 
;;; is protected from any other access 
;;; If multiple counters are needed it is better to use a generator
;;; (see the page on generators)

(let ((counter 0))
  ;; incf increments counter by 1
  (defun bump-up () (incf counter))
  (defun bump-down () (decf counter))
  (defun counter-value () counter))

(bump-up) 
(bump-up)
(counter-value)