ochalog

RubyとMediaWikiとIRCが好き。

Scheme

SICP:問題2.17

SICP問題2.17の自分の解答。last-pairの実装。Gaucheの単体テストも使ってみた。

SICP: Exercise 1.36

SICP Exercise 1.36 の自分の解答。不動点探索によって方程式の解を見つける練習。平均緩和を行うかどうかでステップ数がどのくらい変わるか。

SICP: Exercise 1.35

SICP Exercise 1.35 の自分の解答。黄金比を不動点探索によって求める。関数を何回も作用させていくことで黄金比に収束していくことも確認した。

SICP: Exercise 1.34

SICP Exercise 1.34 の自分の解答。少し分かりにくい手続き作用の問題。

SICP: Exercise 1.33

SICP Exercise 1.33 の自分の解答。指定した条件を満たす項だけを組み合わせる filtered-accumulate を実装する。より複雑な組合せでも簡潔に書けるようになった。

SICP: Exercise 1.32

SICP Exercise 1.32 の自分の解答。項の集まりを組み合わせるアキュミュレーションという演算を実装する。和や積はその特別な場合であることを示す。

SICP: Exercise 1.31

SICP Exercise 1.31 の自分の解答。積を求める高階手続き product を書き、それを使ってみる。

SICP: Exercise 1.30

SICP Exercise 1.30 の自分の解答。和を求める手続き sum を反復的プロセスで書き直す。

SICP: Exercise 1.29

SICP Exercise 1.29 の自分の解答。Simpson の公式を使って精度の良い数値積分を行う。

SICP: Exercise 1.28

SICP Exercise 1.28 の自分の解答。Carmichael 数にだまされない素数性テストである Miller-Rabin テストを実装する。

SICP: Exercise 1.27

SICP Exercise 1.27 の自分の解答。Carmichael 数が Fermat テストをだますことを示す。

SICP: Exercise 1.26

SICP Exercise 1.26 の自分の解答。再帰のちょっとした書き方の違いで、段階数に大きな差が出る。

SICP: Exercise 1.25

SICP Exercise 1.25 の自分の解答。expmod を書くときに fast-expt は使えるか?

SICP: Exercise 1.24

SICP Exercise 1.24 の自分の解答。Fermat テストに要する時間はどうなるか。

SICP: Exercise 1.23

SICP Exercise 1.23 の自分の解答。素数性テストで割り切れるかどうかを調べるときは、2 以外は奇数のみを調べればよい。

SICP: Exercise 1.22

SICP Exercise 1.22 の自分の解答。指定範囲の整数の素数性を調べる手続きと、その実行に要する時間について。

SICP: Exercise 1.21

SICP Exercise 1.21 の自分の解答。199、1999、19999 の最小約数は?

SICP: Exercise 1.20

SICP Exercise 1.20 の自分の解答。正規順序評価と作用的順序評価で、実際の実行される演算がどう変わるか。

SICP: Exercise 1.19

SICP Exercise 1.19 の自分の解答。フィボナッチ数を対数段階数で計算する。

SICP: Exercise 1.18

SICP Exercise 1.18 の自分の解答。整数の積を対数段階数で求める手続きの反復プロセス版。

SICP: Exercise 1.17

SICP Exercise 1.17 の自分の解答。加算の繰り返しによって整数の積を求める手続き。

SICP: Exercise 1.16

SICP Exercise 1.16 の自分の解答。逐次平方を使った冪乗 fast-expt を繰り返しプロセスで書く問題。

SICP: Exercise 1.15

SICP Exercise 1.15 の自分の解答。sin x の近似。

SICP: Exercise 1.14

SICP Exercise 1.14 の自分の解答。計算量を求めるのが面倒だった。

SICP: Exercise 1.12

SICP: Exercise 1.12 の自分の解答。パスカルの三角形の値を求める手続きを書いた。

SICP: Exercise 1.11

SICP Exercise 1.11 の自分の解答。再帰的に定義された関数を、再帰的処理と繰り返し処理で書いた。

SICP: Exercise 1.10

SICP Exercise 1.10 の自分の解答。アッカーマン関数の値を求める問題。

SICP: Exercise 1.9

SICP Exercise 1.9 の自分の解答。置換モデルを使って繰り返し処理か再帰的処理かを説明せよ、という問題。

SICP: Exercise 1.7

SICP Exercise 1.7 の自分の解答。情報落ちを防ぐ。

SICP: Exercise 1.6

SICP Exercise 1.6 の自分の解答。手続きで書いた if はうまく動かない。