Sharp Quote

#' is a frequently-used ReadMacro in CommonLisp. ("Sharp quote" because # means 'sharp' in MusicalNotation? and ' is the QuoteOperator? in Lisp.)

 #'foo
expands to (is SyntacticSugar for)
 (function foo)

Every symbol in CommonLisp can refer to both a function and a value. Since
 foo
by itself refers to the value, we write
 (function foo)
to refer to the function. The function special form is also used to create a LexicalClosure from a LambdaExpression. (A lambda expression may also be executed directly, but this actually macro-expands to the (function (lambda ... )) form.

In essence, all this means that function is a special form such that (funcall (function <whatever>) ...) evaluates to (<whatever> ...).

See SingleNamespaceLisp, FunctionLambda.


CategoryCommonLisp


EditText of this page (last edited November 26, 2005) or FindPage with title or text search