Plotting the sine function in the previous section was a bit cumbersome. As an alternative we can use the function plot-function to plot a function of one argument over a specified range. We can plot the sine function using the expression
(plot-function (function sin) (- pi) pi)
The expression (function sin) is needed to extract the function associated with the symbol sin. Just using sin will not work. The reason is that a symbol in Lisp can have both a value, perhaps set using def, and a function definition at the same time. This may seem a bit cumbersome at first, but it has one great advantage: Typing an innocent expression like
(def list '(2 3 4))will not destroy the list function.
Extracting a function definition from a symbol is done almost as often as quoting an expression, so again a simple shorthand notation is available. The expression
#'sinis equivalent to the expression (function sin). The short form #' is usually pronounced sharp-quote. Using this abbreviation the expression for producing the sine plot can be written as
(plot-function #'sin (- pi) pi).