理系学生日記

おまえはいつまで学生気分なのか

問題1-31(b)

問題1-31(a) - 理系学生日記のproductは反復的プロセスだったので、次に再帰的プロセスのproductかく。

(define (product-recursive term a next b)
  (if (> a b)
      1
      (* (term a)
	 (product-recursive term (next a) next b))))

もちろん6!を計算する。

gosh> (product-recursive identity 1 inc 6)
720