Code Review

Compare your solutions

    #| BEGIN (Введите свое решение) |#
(define (f n)
  (if (< n 3)
      n
      (+ (f (- n 1))
         (* 2 (f (- n 2)))
         (* 3 (f (- n 3))))))

(define (calc x y z) (+ x (* 2 y) (* 3 z)))

(define (f-iter-recursive x y z threshold)
  (if (< threshold 3)
      x
      (f-iter-recursive (calc x y z)
                        x
                        y
                        (- threshold 1))))

(define (f-iter n)
  (if (< n 3)
      n
      (f-iter-recursive 2 1 0 n)))
#| END |#