If answered a similar question already on Stackoverflow. It's a duplicate. Would need to find it.
Anyway.
(defun makefun(x) ;1
(lambda (z)
(+ x z)))
((makefun 1) 2)
Common Lisp does not allow evaluation in the function position. It requires you to put a symbol or an actual lambda expression there.
Remember: Common Lisp has a separate function namespace. The value namespace is different. Here MAKEFUN
returns a value and this value is not available in the function namespace.
There are only two syntactic ways to call a function:
(foo 1 2)
and
((lambda (a b) (list a b)) 1 2)
See CLHS (Conses as Forms). Here we have a Lambda Form.
Adding the capability to write ((some-function-returning-function) 1 2)
would make function calling in Common Lisp more confusing:
(foo 1 2)
would use the function namespace
((some-function-returning-function) 1 2)
would use the value namespace