Code Review

Compare your solutions

    #| BEGIN (Введите свое решение) |#
(define (cont-frac n d k)
  (define (iter i result)
    (if (= i 0)
        result
        (iter (- i 1) (/ (n i) (+ (d i) result)))))

  (iter k 0))

; (define (d i)
;   (cond ((not (= (remainder i 3) 2)) 1)
;         (else (* (/ (+ i 1) 3) 2))))

(+ (cont-frac (lambda (i) 1.0)
           (lambda (i) (if (= (remainder i 3) 2)
                             (* (/ (+ i 1) 3) 2)
                             1))
           1000) 2)
#| END |#