(define (inc n) (+ n 1))
(define (cube x) (* x x x))
(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 k 0)
(define h (/ (- b a) n))
(define (coeff k)
(cond ((= k 0) 1)
((= k n) 1)
((= k 1) 4)
((= (% k 2) 0) 2)
(else 4)))
(* (/ h 3)
(sum (* (coeff k)
(f (+ a (* k h)))) k inc b)))
==========================================
When I evaluate (simpson cube 0 1 100) I get an error saying: "procedure application: expected procedure, given: 0; arguments were: 0" which points to line 8.