Implemented exercises 9 and 10 : recursion generalization over higher-order functions