2015年5月9日土曜日

開発環境

計算機プログラムの構造と解釈[第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.53.を解いてみる。

その他参考書籍

問題2.53.

コード(Emacs)

(list 'a 'b 'c)                         ; (a b c)

(list (list 'george))                   ; ((george))

(cdr '((x1 x2) (y1 y2)))                ; ((y1 y2))

(cadr '((x1 x2) (y1 y2)))               ; (y1 y2)

(pair? (car '(a short list)))           ; #f

(memq 'red '((red shoes) (blue socks))) ; #f

(memq 'red '(red shoes blue socks))     ; (red shoes blue socks)

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

$ kscheme < sample53.scm 
kscm> (a b c)
kscm> ((george))
kscm> ((y1 y2))
kscm> (y1 y2)
kscm> #f
kscm> #f
kscm> (red shoes blue socks)
kscm> $

0 コメント:

コメントを投稿