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

[RFC]: add @stdlib/iter/cunone #2333

Closed
3 tasks done
kgryte opened this issue Jun 8, 2024 · 7 comments · Fixed by #2978
Closed
3 tasks done

[RFC]: add @stdlib/iter/cunone #2333

kgryte opened this issue Jun 8, 2024 · 7 comments · Fixed by #2978
Assignees
Labels
Accepted RFC feature request which has been accepted. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Feature Issue or pull request for adding a new feature. Good First Issue A good first issue for new contributors! JavaScript Issue involves or relates to JavaScript. priority: Normal Normal priority concern or feature request. RFC Request for comments. Feature requests and proposed changes.

Comments

@kgryte
Copy link
Member

kgryte commented Jun 8, 2024

Description

This RFC proposes adding the package @stdlib/iter/cunone, which cumulatively tests whether every iterated value is falsy. The function should be a transform iterator, continuing to iterate while source iterator values are available.

var array2iterator = require( '@stdlib/array/to-iterator' );

var arr = array2iterator( [ false, false, false, true, false ] );

var it = iterCuNone( arr );

var v = it.next().value;
// returns true

v = it.next().value;
// returns true

v = it.next().value;
// returns true

v = it.next().value;
// returns false

v = it.next().value;
// returns false

var bool = it.next().done;
// returns true

Related Issues

No.

Questions

No.

Other

  • See also @stdlib/iter/none

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
@kgryte kgryte added RFC Request for comments. Feature requests and proposed changes. Feature Issue or pull request for adding a new feature. Accepted RFC feature request which has been accepted. Good First Issue A good first issue for new contributors! priority: Normal Normal priority concern or feature request. JavaScript Issue involves or relates to JavaScript. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. labels Jun 8, 2024
@ruthwikchikoti
Copy link
Contributor

Hi @kgryte , could you please assign this issue to me?

@kgryte
Copy link
Member Author

kgryte commented Jul 10, 2024

@ruthwikchikoti Yes, and I suggest you focus on addressing RFC before working on #1632. The README issue is less useful than adding this feature.

ruthwikchikoti added a commit to ruthwikchikoti/stdlib that referenced this issue Jul 16, 2024
Implement iterCuNone to create an iterator which cumulatively tests
whether every iterated value is falsy. This new function:

- Takes an input iterator
- Returns a new iterator that yields boolean values
- Continues yielding  while all values are falsy
- Yields  once a truthy value is encountered
- Handles both iterable and non-iterable input iterators

Includes:
- Main implementation
- TypeScript typings
- Tests
- Benchmarks
- Example usage
- Documentation

Closes stdlib-js#2333
@ruthwikchikoti
Copy link
Contributor

@kgryte review this !!

@ruthwikchikoti
Copy link
Contributor

@kgryte please review ?

@adityacodes30
Copy link
Contributor

seems like the linked pr has not been rectified in over 2 months, ill go ahead and start on this if thats okay

@kgryte
Copy link
Member Author

kgryte commented Sep 28, 2024

@adityacodes30 Yes, that is fine. I have now closed the prior linked PR due to inactivity.

@adityacodes30
Copy link
Contributor

adityacodes30 commented Sep 28, 2024

Great , I'll deliver on this in ~72h

Planeshifter added a commit that referenced this issue Oct 8, 2024
PR-URL: #2978 
Closes: #2333

Co-authored-by: Philipp Burckhardt <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted RFC feature request which has been accepted. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Feature Issue or pull request for adding a new feature. Good First Issue A good first issue for new contributors! JavaScript Issue involves or relates to JavaScript. priority: Normal Normal priority concern or feature request. RFC Request for comments. Feature requests and proposed changes.
Projects
None yet
3 participants