Implement a Path.prototype.replace method.

For Path objects corresponding to array elements, this method accepts any
number of arguments, so for example `elemPath.replace()` has the effect of
removing the element from the array and adjusting the names of all the
other element paths affected by the removal.