Код Ревью

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

    #| BEGIN (Write your solution here) |#
;recursive
(define (filtered-accumulate combiner null-value term a next b pred?)
  (cond ((> a b) null-value)
        ((pred? a) 
         (combiner (term a) 
                   (filtered-accumulate combiner 
                                        null-value 
                                        term   
                                        (next a)    
                                        next 
                                        b      
                                        pred?)))
        (else (filtered-accumulate combiner 
                                   null-value 
                                   term 
                                   (next a) 
                                   next 
                                   b 
                                   pred?))))

;iterative
(define (filtered-accumulate combiner 
                             null-value term a next b pred?)
  (define (iter a result)
    (cond ((> a b) result)
          ((pred? a) 
           (iter (next a) (combiner (term a) result)))
          (else (iter (next a) result))))
  (iter a null-value))
#| END |#