while's -> tailrec