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

Improve documentation of cache #124

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/IterTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,13 @@ julia> collect(c);
julia> collect(c);

```
Be aware that if iterating the original has a side-effect it will not be repeated when iterating again, -- indeed that is a key feature of the `CachedIterator`.
Be aware also that if the original iterator is nondeterminatistic in its order, when iterating again from the cache it will infact be determinatistic and will be the same order as before -- this also is a feature.
If the original iterator has side effects, these side effects will only occur during
the initial iteration and not on subsequent iterations. This is a key feature of the
`CachedIterator.`

If the original iterator produces elements in a nondeterministic order, the cached version
will produce elements in a deterministic order, matching the order of the first iteration.
This is also a feature of the `CachedIterator`.
"""
function cache(it::IT) where IT
EL = eltype(IT)
Expand Down
Loading