Код Ревью
Сравни свои решения
#| BEGIN (Write your solution here) |#
(define (product term a next b)
(if (> a b)
1
(* (term a)
(product term (next a) next b))))
(define (factorial n)
(product identity 1 inc n))
(define (wallis n)
(define (nom-term k)
(+ 4 (* 2 (quotient k 2))))
(define (den-term k)
(+ 3 (* 2 (quotient k 2))))
(exact->inexact (* 4 (/ (* 2 (product nom-term 0 inc (- n 2)))
(product den-term 0 inc (- n 1))))))
#| END |#
#| BEGIN (Write your solution here) |#
(define (product term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (* result (term a)))))
(iter a 1))
(define (factorial n)
(product identity 1 inc n))
(define (wallis n)
(define (nom-term k)
(+ 4 (* 2 (quotient k 2))))
(define (den-term k)
(+ 3 (* 2 (quotient k 2))))
(exact->inexact (* 4 (/ (* 2 (product nom-term 0 inc (- n 2)))
(product den-term 0 inc (- n 1))))))
#| END |#
#| BEGIN (Write your solution here) |#
(define (product term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (* result (term a)))))
(iter a 1))
(define (factorial n)
(product identity 1 inc n))
(define (wallis n)
(define (nom-term k)
(+ 4 (* 2 (quotient k 2))))
(define (den-term k)
(+ 3 (* 2 (quotient k 2))))
(exact->inexact (* 4 (/ (* 2 (product nom-term 0 inc (- n 2)))
(product den-term 0 inc (- n 1))))))
#| END |#
#| BEGIN (Write your solution here) |#
(define (product term a next b)
(if (> a b)
1
(* (term a)
(product term (next a) next b))))
(define (factorial n)
(product identity 1 inc n))
(define (wallis n)
(define (nom-term k)
(+ 4 (* 2 (quotient k 2))))
(define (den-term k)
(+ 3 (* 2 (quotient k 2))))
(exact->inexact (* 4 (/ (* 2 (product nom-term 0 inc (- n 2)))
(product den-term 0 inc (- n 1))))))
#| END |#
#| BEGIN (Write your solution here) |#
(define (product term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (* result (term a)))))
(iter a 1))
(define (factorial n)
(product identity 1 inc n))
(define (wallis n)
(define (nom-term k)
(+ 4 (* 2 (quotient k 2))))
(define (den-term k)
(+ 3 (* 2 (quotient k 2))))
(exact->inexact (* 4 (/ (* 2 (product nom-term 0 inc (- n 2)))
(product den-term 0 inc (- n 1))))))
#| END |#
#| BEGIN (Write your solution here) |#
(define (product term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (* result (term a)))))
(iter a 1))
(define (factorial n)
(product identity 1 inc n))
(define (wallis n)
(define (nom-term k)
(+ 4 (* 2 (quotient k 2))))
(define (den-term k)
(+ 3 (* 2 (quotient k 2))))
(exact->inexact (* 4 (/ (* 2 (product nom-term 0 inc (- n 2)))
(product den-term 0 inc (- n 1))))))
#| END |#