Skip to main content
1 of 2

How to temporarily change the definition of a function?

In the following code the function foo calls the outer f2 function. How to make it call the anonymous function bound within the let?

(defun f2() (message "outer f2")) (defun foo() (f2)) (let ((f2 #'(lambda () (message "inner f2")))) (foo)) ;; The foo does not call the f2 in the let. ie. prints "outer f2"