In tailrec version final list is in reverse order.