Coming from SchemeLanguage, CommonLisp feels strange in many ways. One is the convention of writing (lambda ...) in some places and #'(lambda ...) or the equivalent (function (lambda ...)) in others. Is there an actual difference between the two, and if there is, what is it?
In SchemeLanguage, normal function application (let's ignore macros and special forms) works like this:
This works because functions are just variables containing procedures and lambda is a special form creating procedures. An example:
((lambda (x) x) (+ 3 5))
(lambda (x) x) evaluates to a procedure which returns whatever we give it, (+ 3 5) evaluates to 8. Then the procedure is executed with 8 as parameter, giving us the result of 8.
In CommonLisp however, there is no special form "lambda", and the first position of an expression is never evaluated. Instead, the first position should be a symbol or a lambda expression, corresponding to a named procedure or creating an anonymous one:
In order to be able to pass procedures as parameters, the function special form exists. (function
So actually the FunctionLambda (or SharpQuote lambda) thing makes sense. You just have to see things a little differently than you're used to.
For further reference: