There are a number of special forms which look like function calls but
aren't. These include control constructs such as if
statements and do
loops; assignments like setq
, setf
, push
, and pop
;
definitions such as
defun
and defstruct
; and binding constructs such as
let
. (Not all of
these special forms have been mentioned yet. See below.)
One useful special form is the quote
form: quote
prevents
its argument
from being evaluated. For example:
> (setq a 3)
3
> a
3
> (quote a)
A
> 'a ;'a is an abbreviation for (quote a)
;it's the quote next to the enter key
;on a qwerty keyboard
A
Another similar special form is the function
form: function
causes its
argument to be interpreted as a function rather than being evaluated.
For example:
> (setq + 3)
3
> +
3
> '+
+
> (function +)
#<Function + @ #x-fbef9de>
> #'+ ;#'+ is an abbreviation for (function +)
#<Function + @ #x-fbef9de>
The function
special form is useful when you want to pass a function as
an argument to another function. See below for some examples of
functions which take functions as arguments.