CLHS: Section 3.1.1.1
http://d.hatena.ne.jp/cranebird/20080330/1206890819 の続き。
Macro defun の設定を見ると、
Defines a new function named function-name in the global environment.
とあり、
Global Environments の
bindings of functions, macros, and special operators.
と符合する。(あとでクロージャーについてもちゃんと調べなくては。)
Special operator flet のほうは、
The names of functions defined by flet are in the lexical environment;
とこちらも符合する。
で肝心の入れ子の let だが、lexical scope という言葉で言い尽くされているのだろうか。。
Lisp interpreter を作り直し。http://satoshi.blogs.com/life/2008/03/post-11.html 「作っては壊す」過程があってこそ良いものが作れる、
というのは実に、何かを作ろうとする時にはとても勇気づけられる(一方作業をしているときには手戻りしないために注意をするが)。
前回は 四則演算の次は defun をいきなり作ったが、今回は defun より前に let を作った。またメソッドなどを CLHS をよくよむことで(多少)向上した知識をもとに修正。ユニットテストも前回作ったものを流用。