I am a bit confused about when to NOT use the quote before a symbol.
For example if I want to remove a function from my image:
> (fmakunbound 'func-name)
FUNC-NAME
but, if i create a function for doing the same thing, it looks like this:
(defun remove-func (symbol)
(fmakunbound symbol))
In the second example, why does the fmakunbound
in the remove-func
function not need the quoted symbol?
You might want to make sure you understand evaluation rules.
> foo ; -> this is a variable, the result is its value
> 'foo ; -> this is the expression (QUOTE FOO), the result is the symbol FOO
and
> (sin x) ; -> calls the function SIN with the value of the variable X
> (sin 'x) ; -> calls the function SIN with the symbol X.
; ==> this is an ERROR, since SIN expects a number
> (fmakunbound FOO) ; calls FMAKUNBOUND with the value of the variable FOO
; , whatever it is
> (fmakunbound 'FOO) ; calls FMAKUNBOUND with the result of evaluating 'FOO
; 'FOO evaluates to the symbol FOO.
; thus FMAKUNBOUND is called with the symbol FOO
; thus FMAKUNBOUND removes the function binding
; from the symbol FOO