2015年5月10日日曜日

開発環境

計算機プログラムの構造と解釈[第2版](ハロルド エイブルソン (著)、ジュリー サスマン (著)、ジェラルド・ジェイ サスマン (著)、Harold Abelson (原著)、Julie Sussman (原著)、Gerald Jay Sussman (原著)、和田 英一 (翻訳)、翔泳社、原書: Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)(SICP))の2(データによる抽象の構築)、2.3(記号データ)、2.3.1(クォート)、問題2.54.を解いてみる。

その他参考書籍

問題2.54.

コード(Emacs)

(define equal?
  (lambda (a b)
    (if (and (pair? a)
             (pair? b))
        (and (eq? (car a)
                  (car b))
             (equal? (cdr a)
                     (cdr b)))
        (eq? a b))))

(begin (newline)
       (display (equal? '(this is a list) '(this is a list)))
       (newline)
       (display (equal? '(this is a list) '(this (is a) list))))

入出力結果(Terminal(kscheme), REPL(Read, Eval, Print, Loop))

$ kscheme < sample54.scm
kscm> kscm> 
#t
#f
kscm> $

0 コメント:

コメントを投稿