onlispで提示された aif コードをパッケージに入れ、それを別のパッケージで使用しようとすると、packagename:it が外部ではないという問題が発生します。
(in-package :packagename)
(defmacro aif (test-form then-form &optional else-form)
‘(let ((it ,test-form))
(if it ,then-form ,else-form)))
必要な呼び出し構文
(in-package :otherpackage)
(aif (do-stuff)
(FORMAT t "~a~%" it)
(FORMAT t "just got nil~%"))
パッケージ宣言で変数を外部にせずに、コードでこの動作を修正するにはどうすればよいですit
か?it
packagename:it