foldLeft, foldRight tailrec