開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Scheme (プログラミング言語)
- Gauche (処理系)
計算機プログラムの構造と解釈(Gerald Jay Sussman(原著)、Julie Sussman(原著)、Harold Abelson(原著)、和田 英一(翻訳)、ピアソンエデュケーション、原書: Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)(SICP))の1(手続きによる抽象の構築)、1.3(高階手続きによる抽象)、1.3.2(lambdaを使う手続きの構築)、教書変数を作り出すletの使い方、問題 1.34.を解いてみる。
その他参考書籍
- Instructor's Manual to Accompany Structure & Interpretation of Computer Programs
- プログラミングGauche (Kahuaプロジェクト (著), 川合 史朗 (監修), オライリージャパン)
問題 1.34.
手続きfを2に適用する、そして2を2に適用することになり、2は手続きではないのでエラーになる。
置き換えモデルで表してみる。
(f f) (f 2) (2 2)
確認。
入出力結果(Terminal(gosh), REPL(Read, Eval, Print, Loop))
$ gosh> (define (f g) (g 2)) f gosh> (f f) *** ERROR: invalid application: (2 2) Stack Trace: _______________________________________ gosh> (exit) $
0 コメント:
コメントを投稿