If I call the following lambda in the REPL, everything works as I'd expect:
CL-USER> (funcall (lambda (x) x) 3)
3
CL-USER> ((lambda (x) x) 3)
3
Now, if I nest the lambda into another lambda, I can't call it without funcall anymore.
CL-USER> (funcall (funcall (lambda () (lambda (x) x))) 3)
3
CL-USER> (funcall ((lambda () (lambda (x) x))) 3)
3
CL-USER> (((lambda () (lambda (x) x))) 3)
; in: ((LAMBDA () (LAMBDA (X) X))) 3
; (((LAMBDA () (LAMBDA (X) X))) 3)
;
; caught ERROR:
; illegal function call
;
; compilation unit finished
; caught 1 ERROR condition
; Evaluation aborted on #<SB-INT:COMPILED-PROGRAM-ERROR {1009F09D13}>.
I believe the answer must be very simple, but I haven't been able to figure it out. Why does that happen?