開発環境
- OS X Lion - Apple(OS)
- Emacs、BBEdit - Bare Bones Software, Inc. (Text Editor)
- プログラミング言語: MIT/GNU Scheme
計算機プログラムの構造と解釈(Gerald Jay Sussman(原著)、Julie Sussman(原著)、Harold Abelson(原著)、和田 英一(翻訳)、ピアソンエデュケーション)の1(手続きによる抽象の構築)、1.3(高階手続きによる抽象)、1.3.2(lambda を使う手続きの構築)の問1.34を解いてみる。
その他参考書籍
問題 1.34.
置き換えモデル。
(f f) (f 2) (2 2)
ということで、(2 2)が評価されるけど、2は手続きじゃないからエラー。
確認。
入出力結果(Terminal, REPL(Read, Eval, Print, Loop))
1 ]=> (f square) ;Value: 4 1 ]=> (f (lambda (z) (* z (+ z 1)))) ;Value: 6 1 ]=> (2 2) ;The object 2 is not applicable. ;To continue, call RESTART with an option number: ; (RESTART 2) => Specify a procedure to use in its place. ; (RESTART 1) => Return to read-eval-print level 1. 2 error> (restart 1) ;Abort! 1 ]=> (f f) ;The object 2 is not applicable. ;To continue, call RESTART with an option number: ; (RESTART 2) => Specify a procedure to use in its place. ; (RESTART 1) => Return to read-eval-print level 1. 2 error> (restart 1) ;Abort! 1 ]=> ^D End of input stream reached. Moriturus te saluto.
0 コメント:
コメントを投稿