Skip to content

Add findSliceIndex function to other collections #167

Closed

Description

@cannorin

Description

Related: #158 (comment)

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 element String.findIndex.

Activity

  1. gusty commented on Jul 29, 2019

    @gusty
    Member

    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 ;)

  2. cannorin commented on Jul 30, 2019

    @cannorin
    MemberAuthor

    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.

  3. gusty commented on Jul 30, 2019

    @gusty
    Member

    Yes, go ahead please !

  4. wallymathieu commented on Jul 30, 2019

    @wallymathieu
    Member

    Sounds nice. Would it make sense to have a Slice module?

  5. gusty commented on Jul 31, 2019

    @gusty
    Member

    We can consider it if we ever decide to split our functions in modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions