recursion in scala