-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Is your feature request related to a problem? Please describe.
In order to chain functions at the moment, we need to wrap the iterators in this package within a type cast, for examples:
number := iter.Iterator[int](slices.Values([]int{1, 2, 3})).Take(2).Collect()
This was a deliberate decision in order to provide a toolset of iterators that can be used natively with the Go standard library without type casting.
Unfortantely this comes at the expense of making chaining cumbersome.
Describe the solution you'd like
Consider moving the function chaining aspect to a sub package, and provide versions of every iterator that return an Iterator
rather than a Seq
so that chaning can be used easily. For example:
numbers := iter.Count[int]().Take(5).Collect()
We'd also need to provide wrappers around the standard library functions that return iterators such as slices.Values
and maps.All
.
I'm open to being convinced that this is not a worthwhile idea.
Provide code snippets to show how this new feature might be used.
See above.
Does this incur a breaking change?
Yes.
Do you intend to build this feature yourself?
Yes.