1.43 Exercise 1.43

We can define repeated simply using compose from the last exercise:

(define (repeated f times)
  (if (= times 1) f
      (compose f (repeated f (- times 1)))))

The main idea is that repeating f t times is equivalent to applying f to f repeated t - 1 times, with a base case of f repeated 1 time, which is just f.