Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #791 +/- ##
==========================================
+ Coverage 94.26% 94.36% +0.09%
==========================================
Files 18 18
Lines 2860 2891 +31
==========================================
+ Hits 2696 2728 +32
Misses 149 149
+ Partials 15 14 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // Tee duplicates the stream into multiple output channels without blocking. | ||
| // If an output channel is full or not ready, the value is dropped for that channel. | ||
| func Tee[T any](count, channelsBufferCap int, upstream <-chan T) []<-chan T { |
There was a problem hiding this comment.
In my opinion, this function is too specific.
There was a problem hiding this comment.
Do you mean we should remove Tee because FanOut/FanIn already cover this, or keep it as a separate helper?
There was a problem hiding this comment.
I agree with @d-enk .
Please open a new PR for further discussion.
Also: I would rename it in something more similar to FanOut: FanOutBestEffort, FanOutNonBlocking, FanOutLossy, FanOutDrop, FanOutFireAndForget, other ?
There was a problem hiding this comment.
Done. I've removed the Tee function and all references to it from this PR.
|
I still find channel functions questionable. I suggest splitting the pull request into two parts. As it should have been from the beginning |
|
Just as I already suggested in a private message, I propose to split switch {
case step == size:
...
case step < size:
...
case step > size:
...
} |
|
|
||
| // TakeFilter filters elements and takes the first n elements that match the predicate. | ||
| // Equivalent to calling Take(FilterI(...)), but more efficient as it stops after finding n matches. | ||
| func TakeFilter[T any, I ~func(func(T) bool)](collection I, n int, predicate func(item T, index int) bool) I { |
There was a problem hiding this comment.
Can you rename it to TakeFilterI and add a TakeFilter variant please?
(also in error below + doc)
There was a problem hiding this comment.
Done. Renamed to TakeFilterI and added a TakeFilter variant.
| // Tee duplicates the stream into multiple output channels without blocking. | ||
| // If an output channel is full or not ready, the value is dropped for that channel. | ||
| func Tee[T any](count, channelsBufferCap int, upstream <-chan T) []<-chan T { |
There was a problem hiding this comment.
I agree with @d-enk .
Please open a new PR for further discussion.
Also: I would rename it in something more similar to FanOut: FanOutBestEffort, FanOutNonBlocking, FanOutLossy, FanOutDrop, FanOutFireAndForget, other ?
Done. Sliding now uses an explicit switch on offset (step - size) for the three cases. |
|
I'd remove Distinct/DistinctBy too. You can also clean up the title/commits. |
Done |
This was not a call to action for you... |
|
Oops, sorry. You wrote EDIT: I reverted the last commit. EDIT2: Thanks to both of you. I'm targeting a new release this week. |
This reverts commit 6d2fcdc.
|
I completely missed that As if |
This PR is a follow‑up to the previous slice‑helpers PR. It adds iterator versions of Take, TakeWhile, and TakeFilter along with tests, examples, and docs.