(define (compose f g)
  (lambda (x) (f (g x))))

(define (repeated f n)
  (define (iter counter newfunc)
    (if (= counter n)
        (compose f newfunc)
        (let ((newfunc1 (compose f newfunc)))
          (iter (+ counter 1) newfunc1))))
  (if (= n 0)
    f
  (iter 1 f)))