1
Vote

MutableLazyList should not force on insert/remove

description

The MutableLazyList class is quite useful in a default-value scenario. Unfortunately, the current implementation forces the evaluation of all values following the index of an insertion/a removal. This should not happen. The class should rewrite the indices passed to the indexer instead.

I would do this by storing values in a List<Tuple<Option<T>,int> where that additional int indicates how the index is to be mapped before supplying it to the function. Alternatively, a second, parallel list would reduce the number of Tuple<,> objects created. The most efficient implementation would probably use some tree structure to store deltas to apply to any given index.

comments