Suppose we have a symbol, with a symbol value and a function value and a property list and let us call it q
. Suppose also that we have a function f
with formal parameter v
, e.g. (f (v) ... )
and call the function like (f q)
.
My question is: what is exactly passed to v
? Are
q
;q
;q
,passed to the formal parameter v
?
If they are all passed to v
, then I am puzzled by the fact that we really need the functions funcall
and apply
. If v
would really have both the value and the function value, then it can surely itself decide that when we write (v 3)
, then it must use the function value of v
instead of (funcall v 3)
. And when we use (setq v 3)
then it must use the value of v
.
What is exactly passed to v
and why v
is not a symbol, but just a "parameter" or "variable", is an enigma to me. But I believe that it was in Lisp 1.5 really a symbol. But in common Lisp, there seems to be some
room to confusion.
If you have
(f q)
it means call the function f
with the value of q
.
f
is a function, so the whole (f q)
is a function form.q
to its value.f
with one value.v
to the passed valuef
...v
is in the source code a symbol, but it denotes a variable. In compiled code the symbol is gone. Since Common Lisp uses lexical bindings, variables are now lexical references.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With