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

drop/dropRight/take/takeRight on TraverseFilter #4696

Open
johnynek opened this issue Jan 3, 2025 · 1 comment
Open

drop/dropRight/take/takeRight on TraverseFilter #4696

johnynek opened this issue Jan 3, 2025 · 1 comment

Comments

@johnynek
Copy link
Contributor

johnynek commented Jan 3, 2025

it occurs to me, strictly speaking, all you need is the total length, current index, and the ability to remove to implement these methods. TraverseFilter seems to have all those.

Should we add those to TraverseFilter and optimize the implementations on the strict collections?

@qxrein
Copy link

qxrein commented Feb 28, 2025

lol that’s an interesting observation! TraverseFilter already provides the necessary capabilities (length, index tracking, and removal), it makes sense to consider adding drop, dropRight, take, and takeRight.

Optimizing these for strict collections would be valuable, especially where we can avoid unnecessary traversals. Also would implementing these directly in TraverseFilter introduce any unexpected performance trade-offs for lazy structures? Curious to hear thoughts on whether this aligns well with existing usage patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants