I am reading SICP to learn Lisp, the book uses Scheme dialect. I want accommodate it to emacs lisp, I find something weird in 3.1.1 and cannot figure it out, say I have a
(defun make-account () (defun withdraw (amount) (print "in withdraw")) (lambda () 'withdraw)) (setq a (make-account)) (withdraw 10)
Execute this file with command
emacs -batch -l test.el yields
"in withdraw". Why is not function
withdraw local in
And if I comment out
(setq a (make-account)), it complains about
Symbol’s function definition is void: withdraw.
What am I missing here? Thanks for any help!