2013年8月24日土曜日

開発環境

計算機プログラムの構造と解釈(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.1(評価器の中核)、問題 4.1を解いてみる。

その他参考書籍

問題 4.1

コード(BBEdit)

sample.scm

;; 左から右
(define (list-of-values exps env)
  (if (no-operands? exps)
      '()
      (let ((a (eval (first-operand exps) env)))
        (cons a
              (list-of-values (rest-operands exps) env)))))

;; 右から左
(define (list-of-values exps env)
  (if (no-operands? exps)
      '()
      (let ((b (eval (list-of-values (rest-operands exps) env))))
        (cons (eval (first-operands exps) env)
              b))))

0 コメント:

コメントを投稿