This is a good question, and one where Common Lisp can be quite confusing. The fact is, for historical reasons, Common Lisp has two namespaces: one for functions and the other for values. For this to happen, there are two different evaluation rules for the position of the head of the function application, and for the rest, the first will evaluate the symbol as the name of the function, and the second will evaluate the symbol as a reference to a variable. Obviously, when the value is actually a function, for example, if you write a mapcar function, you want to do something like
(defun my-mapcar (fl) (if (null l) '() (cons (f (car l)) (my-mapcar f (cdr l)))))
but this will not work - he will complain about f as an unknown function. For these cases, there is a special function called funcall that receives the function and argument for the function and will use this function as usual - and since funcall is a simple function, its arguments are evaluated as usual (as values). Thus, the above should be fixed using it:
(defun my-mapcar (fl) (if (null l) '() (cons (funcall f (car l)) (my-mapcar f (cdr l)))))
As you probably suspect now, there are mirror cases - where you want to evaluate something as a function, rather than as a value. For example, this does not work:
(my-mapcar 1+ '(1 2 3))
because it refers to the variable 1+ , and not to the function. For these cases, there is a special form called function , which evaluates its contents as a function and returns it as a value:
(my-mapcar (function 1+) '(1 2 3))
and it can be shortened with #' :
(my-mapcar
This is not the end of this story - to give a few examples:
in some cases, a simple quoted name may work as a function - for example, '1+ in the last example works - but it’s a kind of hack that can only see globally connected names, so #' almost always better
a similar hack can be used with lambda - so you can use (my-mapcar '(lambda (x) (1+ x)) '(1 2 3)) , in fact, you can use (list 'lambda '(x) '(1+ x)) , which is even worse (and IIRC, not portable), but using (lambda (x) (1+ x)) works because it is implicitly wrapped in #' (try expanding the lambda form as a macro, and you will see it). The hack associated with it allows you to use the lambda expression as the head of a function application (which is one of the things you tried).
let , etc. bind local values, and in some cases you want to bind local functions instead - new binding constructions appear for this: flet and labels
If all this looks strange and / or overly complicated, then you are not alone. This is one of the main differences between Common Lisp and Scheme. (The difference then leads to changes in common idioms in both languages: circuit code tends to use higher-order functions much more often than Common Lisp. As usual, with such religious questions, some people argue in favor of what the CL does, arguing that functions higher order are confusing, so they like the explicit reminder in the code.)