Closed luithefirst closed 4 years ago
Hey, i implemented the most basic ones (IndexList.TryGetNext(index : Index) : Index * a' option
) and I don't think we should add the others, since their runtime would be O(N)
and they can always be expressed via IndexList.toSeqIndexed
. Furthermore they're not unique since the element may occur several times in the list.
As for the ChangeableIndexList
we should maybe do a full cleanup-pass of all changeable types adding lots of missing methods...
For some use cases when manipulating a
ChangeableIndexList
, it would be convenient to explicitly query theNext
andPrev
element.My uses case are:
Add(item : Item, before : Item)
andRemove(item : Item)
by storing(item, before)
Currently there are only the most generic methods
IndexList.TryFind(value : 'a)
andIndexList.Neighbours(index : Index)
and need to be used like this:All possible combinations that query by value and by index would be:
IndexList.TryGetNext(index : Index) : Index * a' option
IndexList.TryGetNext(value : a') : Index * a' option
IndexList.TryGetNextValue(value : a') : a' option
Or at the changeable collection itself:
ChangeableIndexList.TryGetNext(index : Index) : Index * a' option
ChangeableIndexList.TryGetNext(value : a') : Index * a' option
ChangeableIndexList.TryGetNextValue(value : a') : a' option
The highlighted one would the perfect solution for my use cases and was previously available on ChangeableOrderedSet, but I would not want to conclude on what the most general ones are based on them.
The
ChangeableIndexList
could also directly provide more forwarded methods of theIndexList
likeTryFind
.