Skip to content

Documentation and tests for IteratorDecorator. #60

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

Merged
merged 6 commits into from
Oct 24, 2019

Conversation

erikvanoosten
Copy link
Contributor

If this is approved, I will add similar docs and tests for the other intersperse implementations.

@erikvanoosten
Copy link
Contributor Author

I just realized that the correct term for things in a collection is element and not item. I will update this PR.

Corrected order of arguments to assertEquals.
@erikvanoosten
Copy link
Contributor Author

erikvanoosten commented Oct 24, 2019

I completed docs and unit tests for IteratorDecorator.

I did not document lazyFoldLeft and lazyFoldRight since I could not find words to describe their exotic behavior:

    def op(acc: Int, e: => Int): Int = if (acc >= 5) acc + 1 else acc + e
    Iterator(4, 5, 20, 20).lazyFoldLeft(0)(op) === 11

I'll work some more on this project in a new PR.
Comments welcome!

@erikvanoosten
Copy link
Contributor Author

Build fails. I had expected we could use $consumesIterator and $mayNotTerminateInf in the scaladocs...
Should I remove them?

@julienrf
Copy link
Collaborator

I had expected we could use $consumesIterator and $mayNotTerminateInf in the scaladocs...

I suggest that you copy their definitions from the standard library. https://github.com/scala/scala/blob/05d028e0eee1eaf9032e652395b94a124c6ad9ed/src/library/scala/collection/Iterator.scala#L50

@erikvanoosten erikvanoosten changed the title Documentation and tests for Iterator.intersperse. Documentation and tests for IteratorDecorator. Oct 24, 2019
@@ -3,8 +3,39 @@ package decorators

import scala.annotation.tailrec

/** Enriches [[Iterator]] with additional methods.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should be just Iterator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh.

@julienrf
Copy link
Collaborator

Thanks a lot! Could you please squash the comits into a single one?

@erikvanoosten
Copy link
Contributor Author

Isn't squashing an option when you merge in github? If not, I can find out how to do that.

@julienrf julienrf merged commit 233937f into scala:master Oct 24, 2019
@julienrf
Copy link
Collaborator

Right, there is an option for that.

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.

2 participants