this is a source code of functional programming in scala course second assignment (recfun) answer