Ex3.6 スペシャル変数と通常の変数

;;; Exercise 3.6 [s] Given the following initialization for the
;;; lexical variable a and the special variable *b*, what will be the
;;; value of the let form?
(setf a 'global-a)
(defvar *b* 'global-b)
(defun fn () *b*)
(let ((a 'local-a)
      (*b* 'local-b))
  (list a *b* (fn) (symbol-value 'a) (symbol-value '*b*)))
;;=> (LOCAL-A LOCAL-B LOCAL-B GLOBAL-A LOCAL-B)

つまり、

  • free変数の値としては、symbol-valueが使われる
  • スペシャル変数は、lexical変数導入でsymbol-valueの束縛も変更される。lexical変数のスコープを抜けるとsymbol-valueが復元される
  • 一方、通常の変数は、lexical変数導入では、symbol-valueの束縛は変更されない

ということですかね。