-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: implement drop
function
#20
Conversation
class SourceOpsDropTest extends AnyFlatSpec with Matchers { | ||
behavior of "Source.drop" | ||
|
||
it should "not drop from the empty source" in scoped { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use supervised
where possible; it should be our "default" scoping tool, unless some specific requirements necessitate usage of scoped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -141,6 +141,24 @@ trait SourceOps[+T] { this: Source[T] => | |||
|
|||
def take(n: Int)(using Ox, StageCapacity): Source[T] = transform(_.take(n)) | |||
|
|||
/** Drops `n` elements from the source and emits any subsequent elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change the wording slightly to indicate that we return a different source than the current one. E.g.:
Drops `n` elements from this source and forwards any subsequent ones to the returned channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
import ox.* | ||
|
||
class SourceOpsDropTest extends AnyFlatSpec with Matchers { | ||
behavior of "Source.drop" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: How about an additional test case to verify that drop(0)
doesn't drop anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Drop `n` elements from the source and emit subsequent elements (if any left) e.g.: Source.empty[Int].drop(1).toList // List() Source.fromValues(1, 2, 3).drop(1).toList // List(2 ,3) Source.fromValues(1).drop(2).toList // List()
ea8a9c3
to
d738f3d
Compare
Drop
n
elements from the source and emit subsequent elements (if any left) e.g.: