From 63a2351427ae129c7b32cb90c89086da08255107 Mon Sep 17 00:00:00 2001 From: PatrickHaecker <152268010+PatrickHaecker@users.noreply.github.com> Date: Sun, 16 Feb 2025 08:48:27 +0100 Subject: [PATCH 1/2] Improve documentation of `cache` - fix typos - fix typography - improve wording - split long lines --- src/IterTools.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/IterTools.jl b/src/IterTools.jl index 3bb21a8..7fb5878 100644 --- a/src/IterTools.jl +++ b/src/IterTools.jl @@ -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 not occur +again when you iterate over the cached version. 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) From 7c1a8689921661805d2be19b6893f3c463bfc5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=A4cker?= Date: Wed, 19 Feb 2025 05:03:40 +0100 Subject: [PATCH 2/2] Improve wording and wrapping of `cache` comment This was found during review by omus. --- src/IterTools.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/IterTools.jl b/src/IterTools.jl index 7fb5878..4eb5173 100644 --- a/src/IterTools.jl +++ b/src/IterTools.jl @@ -1058,13 +1058,13 @@ julia> collect(c); julia> collect(c); ``` -If the original iterator has side effects, these side effects will not occur -again when you iterate over the cached version. This is a key feature of the +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`. +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)