2014年4月19日土曜日

開発環境

計算機プログラムの構造と解釈(Gerald Jay Sussman(原著)、Julie Sussman(原著)、Harold Abelson(原著)、和田 英一(翻訳)、ピアソンエデュケーション、原書: Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)(SICP))の2(データによる抽象の構築)、2.3(記号データ)、2.3.1(クォート)、問題 2.53.を解いてみる。

その他参考書籍

問題 2.53.

コード(BBEdit, Emacs)

sample.scm

#!/usr/bin/env gosh
;; -*- coding: utf-8 -*-

;; これまでに書いた手続き
(load "./procedures.scm")

(for-each print
          (list (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(gosh), REPL(Read, Eval, Print, Loop))

$ ./sample.scm
(a b c)
((george))
((y1 y2))
(y1 y2)
#f
#f
(red shoes blue socks)
$

0 コメント:

コメントを投稿