Код Ревью

Сравни свои решения

    #| BEGIN (Write your solution here) |#
(define (inc n) (+ n 1))

(define (even? n)
  (= (remainder n 2) 0))

(define (sum term a next b)
  (if (> a b)
      0
      (+ (term a)
         (sum term (next a) next b))))
(define (simpson f a b n)
  (define h (/ (- b a) (* 1.0 n)))
  (define (simpson-term k) (* (coefficient k) (f (+ a (* k h)))))
  (define (coefficient k)
    (cond ((or (= k 0) (= k n)) 1.0)
          ((even? k) 2.0)
          (else 4.0)))
  (* (sum simpson-term 0 inc n)
     (/ h 3.0)))
#| END |#