2009-08-31から1日間の記事一覧

問題1.33

ここまでくると、コードから意味を読み取るのは大変。馴れが重要なのかな? filtered-accumulate (define (filtered-accumulate filter combiner null-value term a next b) (if (> a b) null-value (if (filter a) (combiner (term a) (filtered-accumulate…

問題1.32

この辺から、抽象化しすぎで段々雲行きが怪しくなる。 実際にこのようなコードを書いたとしたら、ちゃんとメンテできるだろうか? accumulate再帰的手続き (define (accumulate combiner null-value term a next b) (if (> a b) null-value (combiner (term …

問題1.31

今日は比較的順調。 product手続き (define (product term a next b) (if (> a b) 1 (* (term a) (product term (next a) next b)))) productを使ったfactorial (define (factorial n) (define (term x) x) (define (next n) (+ n 1)) (product term 1 next …