I'm trying to use a function to return a function in common lisp. However, I've run into a strange situation I'd like explained.
This is what I want to do:
(defun makefun(x) ;1
(lambda (z)
(+ x z)))
((makefun 1) 2) ;2
This results in an illegal function call. However, the following are valid:
((lambda (z) (+ 1 z)) 2) ;3
(funcall (makefun 1) 2) ;4
Why can I not use makefun as in the first example? I'd expect the call in 2 to be evaluated so it would be equivalent to line 3.