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

Add ZStrem#zip left and right operators and alias for all zip operators #1510

Merged
merged 8 commits into from Sep 13, 2019
Merged

Add ZStrem#zip left and right operators and alias for all zip operators #1510

merged 8 commits into from Sep 13, 2019

Conversation

jadireddi
Copy link
Contributor

Adding ZStrem#zipLeft and zipRight operators and operator alias for all ZStream#zip* functions.

Issue: #1496

@iravid
Copy link
Member

iravid commented Aug 28, 2019

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.
Copy link
Member

@iravid iravid Aug 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Copy link
Contributor Author

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] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@iravid
Copy link
Member

iravid commented Sep 1, 2019

@jadireddi Could you also add the cross / crossWith named methods? I've edited the description for the original issue.

@jadireddi
Copy link
Contributor Author

@iravid , Fixed the review comments. Kindly review them.

@jadireddi
Copy link
Contributor Author

@iravid , Could you please review the code and let me know if any changes needed.

Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jadireddi!

@iravid iravid merged commit d7df03e into zio:master Sep 13, 2019
fsvehla pushed a commit to fsvehla/zio that referenced this pull request Sep 21, 2019
…, &> (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.
adamgfraser added a commit that referenced this pull request Nov 7, 2019
* 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
Twizty pushed a commit to Twizty/zio that referenced this pull request Nov 13, 2019
* 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
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

Successfully merging this pull request may close these issues.

None yet

2 participants