計算機プログラムの構造と解釈[第2版]
(翔泳社)
ハロルド エイブルソン (著) ジュリー サスマン (著)
ジェラルド・ジェイ サスマン (著)
Harold Abelson (原著) Julie Sussman (原著)
Gerald Jay Sussman (原著) 和田 英一 (翻訳)
開発環境
- OS X Yosemite - Apple (OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Scheme (プログラミング言語)
- Gauche (処理系)
計算機プログラムの構造と解釈[第2版](ハロルド エイブルソン (著)、ジュリー サスマン (著)、ジェラルド・ジェイ サスマン (著)、Harold Abelson (原著)、Julie Sussman (原著)、Gerald Jay Sussman (原著)、和田 英一 (翻訳)、翔泳社、原書: Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)(SICP))の1(手続きによる抽象の構築)、1.2(手続きとその生成するプロセス)、1.2.3(増加の程度)、問題 1.15.を解いてみる。
その他参考書籍
- Instructor's Manual to Accompany Structure & Interpretation of Computer Programs
- プログラミングGauche (Kahuaプロジェクト (著), 川合 史朗 (監修), オライリージャパン)
- Scheme手習い
問題 1.15.
-
コード(BBEdit, Emacs)
sample14.scm
#!/usr/bin/env gosh ;; -*- coding: utf-8 -*- (define cube (lambda (x) (* x x x))) (define p (lambda (x) (print "(p " x ")") (- (* 3 x) (* 4 (cube x))))) (define sine (lambda (angle) (if (not (> (abs angle) 0.1)) angle (p (sine (/ angle 3.0)))))) (print "(sine 12.15): " (sine 12.15))
入出力結果(Terminal(gosh), REPL(Read, Eval, Print, Loop))
$ ./sample15.scm (p 0.049999999999999996) (p 0.1495) (p 0.4351345505) (p 0.9758465331678772) (p -0.7895631144708228) (sine 12.15): -0.39980345741334 $
5回作用させられた。
よって、スペース、ステップ数の増加の程度は。
0 コメント:
コメントを投稿