Skip to content

Conversation

@pra2107tham
Copy link

Resolves #2335 .

Description

This pull request adds the iterCuAnyBy function to the @stdlib/iter package. This function creates an iterator that cumulatively tests whether at least one iterated value passes a user-provided predicate function.

Key features and changes:

  • Implements the iterCuAnyBy function, returning an iterator of boolean values.
  • The predicate function receives the value and its index as arguments.
  • The returned iterator yields false until a value passes the predicate, then yields true for all subsequent values.
  • Includes comprehensive unit tests with various test cases.
  • Adds documentation for the function in the README and examples.
  • Updates benchmark tests to include the predicate function.

Related Issues

This pull request resolves #2335.

Questions

None at this time.

Checklist

  • Read, understood, and followed the [contributing guidelines][contributing].

Signed-off-by: Pratham Shirbhate <prathamshirbhate1909@gmail.com>
Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Needs Review A pull request which needs code review. JavaScript Issue involves or relates to JavaScript. labels Jul 10, 2024
Examples
--------
> var arr = {{alias:@stdlib/array/to-iterator}}( [ 0, 0, 0, 1, 0 ] );
> var it = {{alias}}( arr );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to update the example to use a predicate function. It is also missing from the API documentation above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i checked it and updated, how to solve the lint errrors I am getting

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not able to figure out what to do next? can you please tell me whate xacty and how to solve the issue

@kgryte kgryte changed the title feat(iter): Add iterCuAnyBy function for cumulative testing with a predicate feat: add iter/cuany-by Jul 10, 2024
@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Jul 10, 2024
Signed-off-by: Pratham Shirbhate <prathamshirbhate1909@gmail.com>
Signed-off-by: Pratham Shirbhate <prathamshirbhate1909@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add @stdlib/iter/cuany-by

3 participants