Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] idx-of command #196

Open
kurtlawrence opened this issue Apr 3, 2023 · 0 comments
Open

[FEATURE] idx-of command #196

kurtlawrence opened this issue Apr 3, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@kurtlawrence
Copy link
Member

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.

@kurtlawrence kurtlawrence added the enhancement New feature or request label Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant