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
Add ZStrem#zip left and right operators and alias for all zip operators #1510
Conversation
Hi @jadireddi, thanks for picking this up. I updated the original issue - could you follow the requirements there? Thanks! |
@@ -1793,6 +1793,54 @@ class ZStream[-R, +E, +A](val process: ZManaged[R, E, Pull[R, E, A]]) extends Se | |||
*/ | |||
final def zipWithIndex: ZStream[R, E, (A, Int)] = | |||
mapAccum(0)((index, a) => (index + 1, (a, index))) | |||
|
|||
/** | |||
* Runs this stream with the specified stream sequentially. |
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.
* Runs this stream with the specified stream sequentially. | |
* Composes this stream with the specified stream to create a cartesian product of elements. The `that` | |
stream would be run multiple times, for every element in the `this` stream. | |
See also [[ZStream#zip]] and [[ZStream#<&>]] for the more common point-wise variant. |
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.
Fixed
self.flatMap(ls => that.map(rs => (ls, rs))) | ||
|
||
/** | ||
* Runs this stream with the specified stream sequentially and keeps only values of this stream. |
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.
* Runs this stream with the specified stream sequentially and keeps only values of this stream. | |
* Composes this stream with the specified stream to create a cartesian product of elements, and keeps only | |
the elements from the `that` stream. | |
The `that` stream would be run multiple times, for every element in the `this` stream. | |
See also [[ZStream#zipWith]] and [[ZStream#<&>]] for the more common point-wise variant. |
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.
Fixed
/** | ||
* Runs this stream with the specified stream sequentially and keeps only values of this stream. | ||
*/ | ||
final def <*[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, A] = |
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.
final def <*[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, A] = | |
* Composes this stream with the specified stream to create a cartesian product of elements, and keeps only | |
the elements from the `this` stream. | |
The `that` stream would be run multiple times, for every element in the `this` stream. | |
See also [[ZStream#zipWith]] and [[ZStream#<&>]] for the more common point-wise variant. |
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.
Fixed
@jadireddi Could you also add the |
…O-1496-Zstream_zip_operators # Conflicts: # streams/shared/src/main/scala/zio/stream/ZStream.scala
@iravid , Fixed the review comments. Kindly review them. |
…O-1496-Zstream_zip_operators
@iravid , Could you please review the code and let me know if any changes needed. |
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.
Thank you @jadireddi!
…, &> (zio#1510) * Add ZStrem#zip left and right operators and alias for all zip operators * formatted code to make scalafmtCheck pass. * change for <*> variants with flatmap and <&> with zipWith. * adding crossWith and cross functions to ZStream. * merge conflict change. * formatted naming conventions.
* implement permits * make TRef state private * prototype safe semaphore * implement permits * make TRef state private * #1219 - add doUntilEquals and doWhileEquals methods (#1634) * Update zio-interop-reactivestreams to 1.0.3.1-RC1 (#1665) * Add ZStream#cross, crossWith, <*>, <*, *>, <&>, zipLeft, zipRight, <&, &> (#1510) * Add ZStrem#zip left and right operators and alias for all zip operators * formatted code to make scalafmtCheck pass. * change for <*> variants with flatmap and <&> with zipWith. * adding crossWith and cross functions to ZStream. * merge conflict change. * formatted naming conventions. * Update the encoding of ZSink (#1560) * prototype safe semaphore * cleanup * uodate documentation * address review comments * cleanup * add back and deprecate methods * cleanup * make method private
* implement permits * make TRef state private * prototype safe semaphore * implement permits * make TRef state private * zio#1219 - add doUntilEquals and doWhileEquals methods (zio#1634) * Update zio-interop-reactivestreams to 1.0.3.1-RC1 (zio#1665) * Add ZStream#cross, crossWith, <*>, <*, *>, <&>, zipLeft, zipRight, <&, &> (zio#1510) * Add ZStrem#zip left and right operators and alias for all zip operators * formatted code to make scalafmtCheck pass. * change for <*> variants with flatmap and <&> with zipWith. * adding crossWith and cross functions to ZStream. * merge conflict change. * formatted naming conventions. * Update the encoding of ZSink (zio#1560) * prototype safe semaphore * cleanup * uodate documentation * address review comments * cleanup * add back and deprecate methods * cleanup * make method private
Adding
ZStrem#zipLeft and zipRight
operators and operator alias for allZStream#zip*
functions.Issue: #1496