ch5 problems from func prog in scala book