Make is_list iterative rather than recursive

So we avoid blowing the call stack