defun is used to declare a function.
In scheme you used to declare a variable and assigned it a variable expression like this: (define x variable-expression), and when declaring a function you used to write something like this (define x function-expression). Ofc variable-expression could be another variable previously declared or a literal (i.e define x 5, define x y).
The same for a function expression, but when writing a function 'literal' you do it using an anonymous function like this:
(define x (lambda (x) (....)))
where lambda (x) (...) is a function expression that actually returns a function and is assigned to x. So this way x is declared as a function.
defun actually declares a function, not a variable as define does in scheme. So when you write:
(defun sum1
(lambda (n)
(+ n 1)))
What really happens is that sum1 is declared as a function with no arguments that returns another function that actually accepts a variable n and return n+1.
What you really want is sum1 to be declared as a function instead of a function that returns another function, which is what you actually get by using defun and lambda in the same snippet.
EDIT1: you can use your function like this ((sum1) 5)
defunand see that it just doing(defalias 'sum1 (lambda (n) (+ n 1)))(defun make-adder (n) (lambda (x) (+ x n)))that returns a function that adds n to a number. You could have an anonymous function as the value of a variable:(let ((adder (lambda (x) (+ x 2)))) ...).(eval '(defun sum1 () (function (lambda (n) (+ n 1))) t)¨ (funcall (sum1) 5) ; 6evalhere should have no effect other than preventing useful compiler warnings and wrappinglambdainfunctionshould be entirely redundant.