separated functional programming exercise