Add exercise2 (higher-order functions)