Related: https://github.com/fsprojects/FSharpPlus/issues/158#issuecomment-513526420
I propose we add findSliceIndex / tryFindSliceIndex which we recently added to String extension to other collections' extensions.
val findSliceIndex : slice:'Collection<'a> -> source:'Collection<'a> -> int
val tryFindSliceIndex : slice:'Collection<'a> -> source:'Collection<'a> -> int option
It will work just like the existing findIndex : 'a -> 'Collection<'a> -> int but it searches a "slice" (i.e. subsequence, sub-collection) instead of an elementString.findIndex.
I'm personally fine with this, definitely it makes sense to have them for other collections.
It also makes sense to have the generic version, if you are willing to do this PR I leave it to your criteria/willingness to include the generic functions or not.
Of course, I'm happy to help fighting the compiler ;)
We don't have generic findIndex yet, so if we are going to add generic findSliceIndex it is better to add it too. If it's OK I'll start a PR and do both.
Yes, go ahead please !
Sounds nice. Would it make sense to have a Slice module?
We can consider it if we ever decide to split our functions in modules.
Most helpful comment
I'm personally fine with this, definitely it makes sense to have them for other collections.
It also makes sense to have the generic version, if you are willing to do this PR I leave it to your criteria/willingness to include the generic functions or not.
Of course, I'm happy to help fighting the compiler ;)