let and flet in emacs lisp

前端 未结 4 1144
小鲜肉
小鲜肉 2021-01-30 13:31

I don\'t know if you would call it the canonical formulation, but to bind a local function I am advised by the GNU manual to use \'flet\':

(defun adder-with-flet         


        
4条回答
  •  灰色年华
    2021-01-30 13:59

    @d11wq there is `funcall' for this purpose. The following works:

    (defun adder-with-let (x)
      (let ((f #'(lambda (x) (+ x 3))))
        (funcall f 3)))
    
    (adder-with-let 3) ;=> 6
    

提交回复
热议问题