Code Review

Compare your solutions

    #| BEGIN (Введите свое решение) |#
(define (product term a next b)
  (if (> a b)
    1
    (* (term a)
       (product term (next a) next b))))

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

(define (factorial x)
  (product identity 1 inc x))

(define (factorial-iter x)
  (product-iter identity 1 inc x))

(define (wallis-pi n)
  (define (term k)
    (define double-k (* 2 k))
    (/ (* double-k (+ double-k 2))
       (square (+ double-k 1))))
  (* 4 (product-iter term 1.0 inc n)))
#| END |#