Standard higher order function pattern surprisingly doesn't work

22 views Asked by At

I'm not an expert in Emacs Lisp, but I do believe that I know the basics, but in this very basic (minimal reproducible example) instance of the very widespread pattern of using a function as an argument (a pattern I believe to have successfully used in elisp often already) it fails:

(defun test (f)
  (f 5))

(test (lambda (x) (message (format "%d" (+ x 20)))))

Instead of printing "25" it gives the error "Symbol's function definition is void: f".

I tried to search for it, but couldn't find the problem.

Thanks for an answer!

0

There are 0 answers