新千葉 ガーベージ・コレクション

FPGA マガジンやインターフェースで書けなかったこと等をちょぼちょぼ書いてます。@ryos36

SICP

if?

これは簡単だなぁ。ほぼそのまま。 (defun if? (exp) (tagged-list? exp 'if)) (defun if-predicate (exp) (cadr exp)) (defun if-consequent (exp) (caddr exp)) (defun if-alternative (exp) (if (not (null (cdddr exp))) (cadddr exp) nil)) (defun eval…

quoted? と assignment? とdefinition?

quoted? は (quote (a b c)) のように quote で始まるかどうかをチェックしている。lisp ではもっと簡単に '(a b c) と書く。こういう lisp の事情が理解できると quoted? はことさら説明するまでもない。 assignment? は set! で始まる scheme の代入(?)。…