Skip to content

[FEATURE] idx-of command #196

Open
Open

Description

@kurtlawrence

Description

Add a command which uses a predicate and returns the first index where the predicate returns true.

Performs a linear search and stops on the first true of the predicate.
Returns the index matched.

Design notes

  • The name idx-of could also be find-idx
    • find should be reserved for something which returns a TableRow
    • find-idx would actually align with a future find impl
  • What to return on failure?
  • Implement on all the iterables (Table, String)

Alternatively, a numeric like -1 could be returned

A use case is to find an index for insertion or skipping.
In that case, a sensible return value would be beneficial and merits a considered design.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions