To give a bit longer answer, there is a notion in the Lisp family of languages of Lisp-1 vs. Lisp-2. In a Lisp-1 variant (e.g., Scheme), symbols have only a single value. If you see the symbol LIST, for instance, it's always bound to the same thing. This is true whether the symbol appears in the first position of a function call form or anyplace else. In a Lisp-2 variant (e.g., Common Lisp, Emacs Lisp), the symbol LIST can evaluate to two different values depending on where it appears. As the first symbol in a function call, it evaluates to the function associated with the symbol. In any other position, it evaluates to the data value associated with the symbol. This is convenient, because it allows you to have variable names that would otherwise clash with the names of functions. For instance:
- Code: Select all
(defun foo (list) ; LIST is a variable here, no conflict with the LIST function
(list 'a list)) ; First LIST is a call to the LIST function. Second LIST is a reference to the LIST variable.
If you want to access the function associated with a symbol when the reference would otherwise select the data, preface the symbol with pound-tick: #'SYMBOL.