Exercise 1.8 - complete (implement apply)