Continuation passing loop which never bloats stack