Nit: Name is confusing I think `collect(root)` would make more sense, where optional `acc` can be a second argument to support recursive walk.