This practise of setting things to `null` is not great. Just use `delete` (works like python's delete) to set the value at the index to `undefined` and then `compact` to make the list compact.