Functional programming exercise for Mark