開発環境
- OS X Lion - Apple(OS)
- Emacs、BBEdit - Bare Bones Software, Inc. (Text Editor)
- プログラミング言語: MIT/GNU Scheme
計算機プログラムの構造と解釈(Gerald Jay Sussman(原著)、Julie Sussman(原著)、Harold Abelson(原著)、和田 英一(翻訳)、ピアソンエデュケーション、原書: Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)(SICP))の4(超言語的抽象)、4.1(超循環評価器)、4.1.2(式の表現)、問題 4.2を解いてみる。
その他参考書籍
問題 4.2
a.
代入の節(assignment?)の前に手続き作用の節(application?)が現れるようにしたとき、式(define x 3)に対して評価器は、(application?)が先にtrueになるので、変数xの値を3に定義するのではなく、defineという手続きをx 3という引数に作用させることになる。
b.
application?, operator, operandsの3つに変更を加えればいい。
コード(BBEdit)
sample.scm
(define (application? exp) (tagged-list? exp 'call)) (define (operator exp) (cadr exp)) (define (operands exp) (cddr exp))
0 コメント:
コメントを投稿