common-lispFunctions as first class values


  • (function name) ; retrieves the function object of that name
  • #'name ; syntactic sugar for (function name)
  • (symbol-function symbol) ; returns the function bound to symbol
  • (funcall function args...) ; call function with args
  • (apply function arglist) ; call function with arguments given in a list
  • (apply function arg1 arg2 ... argn arglist) ; call function with arguments given by arg1, arg2, ..., argn, and the rest in the list arglist


namesome (unevaluated) symbol which names a function
symbola symbol
functiona function which is to be called or more arguments (not a list of arguments)
arglista list containing arguments to be passed to a function
arg1, arg2, ..., argneach is a single argument to be passed to a function


When talking about Lisp-like languages there is a common distinction between what is known as a Lisp-1 and a Lisp-2. In a Lisp-1, symbols only have a value and if a symbol refers to a function then the value of that symbol will be that function. In a Lisp-2, symbols can have separate associated values and functions and so a special form is required to refer to the function stored in a symbol instead of the value.

Common Lisp is basically a Lisp-2 however there are in fact more than 2 namespaces (things that symbols can refer to) -- symbols can refer to values, functions, types and tags, for example.