From 37d69eef6efdbcf77dfb704ebbdfbfaa0a21a82e Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 24 Nov 2023 08:28:17 +0000 Subject: [PATCH] build based on d76460c --- dev/.documenter-siteinfo.json | 2 +- dev/index.html | 46 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 898d5eb..043e031 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.8.5","generation_timestamp":"2023-11-24T08:27:46","documenter_version":"1.1.2"}} \ No newline at end of file +{"documenter":{"julia_version":"1.8.5","generation_timestamp":"2023-11-24T08:28:14","documenter_version":"1.1.2"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index d99a9a8..637de8a 100644 --- a/dev/index.html +++ b/dev/index.html @@ -7,16 +7,16 @@ 3 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.

source
IterTools.distinctMethod
distinct(xs)

Iterate through values skipping over those already encountered.

julia> for i in distinct([1,1,2,1,2,4,1,2,3,4])
+

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.

source
IterTools.distinctMethod
distinct(xs)

Iterate through values skipping over those already encountered.

julia> for i in distinct([1,1,2,1,2,4,1,2,3,4])
            @show i
        end
 i = 1
 i = 2
 i = 4
-i = 3
source
IterTools.fieldvaluesMethod
fieldvalues(x)

Iterate through the values of the fields of x.

julia> collect(fieldvalues(1 + 2im))
+i = 3
source
IterTools.fieldvaluesMethod
fieldvalues(x)

Iterate through the values of the fields of x.

julia> collect(fieldvalues(1 + 2im))
 2-element Vector{Any}:
  1
- 2
source
IterTools.firstrestMethod
firstrest(xs) -> (f, r)

Return the first element and an iterator of the rest as a tuple.

See also: Base.Iterators.peel.

julia> f, r = firstrest(1:3);
+ 2
source
IterTools.firstrestMethod
firstrest(xs) -> (f, r)

Return the first element and an iterator of the rest as a tuple.

See also: Base.Iterators.peel.

julia> f, r = firstrest(1:3);
 
 julia> f
 1
@@ -24,28 +24,28 @@
 julia> collect(r)
 2-element Vector{Int64}:
  2
- 3
source
IterTools.flagfirstMethod
flagfirst(iter)

An iterator that yields (isfirst, x) where isfirst::Bool is true for the first element, and false after that, while the xs are elements from iter.

julia> collect(flagfirst(1:3))
+ 3
source
IterTools.flagfirstMethod
flagfirst(iter)

An iterator that yields (isfirst, x) where isfirst::Bool is true for the first element, and false after that, while the xs are elements from iter.

julia> collect(flagfirst(1:3))
 3-element Vector{Tuple{Bool, Int64}}:
  (1, 1)
  (0, 2)
- (0, 3)
source
IterTools.groupbyMethod
groupby(f, xs)

Group consecutive values that share the same result of applying f.

julia> for i in groupby(x -> x[1], ["face", "foo", "bar", "book", "baz", "zzz"])
+ (0, 3)
source
IterTools.groupbyMethod
groupby(f, xs)

Group consecutive values that share the same result of applying f.

julia> for i in groupby(x -> x[1], ["face", "foo", "bar", "book", "baz", "zzz"])
            @show i
        end
 i = ["face", "foo"]
 i = ["bar", "book", "baz"]
-i = ["zzz"]
source
IterTools.imapMethod
imap(f, xs1, [xs2, ...])

Iterate over values of a function applied to successive values from one or more iterators. Like Iterators.zip, the iterator is done when any of the input iterators have been exhausted.

julia> for i in imap(+, [1,2,3], [4,5,6])
+i = ["zzz"]
source
IterTools.imapMethod
imap(f, xs1, [xs2, ...])

Iterate over values of a function applied to successive values from one or more iterators. Like Iterators.zip, the iterator is done when any of the input iterators have been exhausted.

julia> for i in imap(+, [1,2,3], [4,5,6])
             @show i
        end
 i = 5
 i = 7
-i = 9
source
IterTools.interleavebyFunction
interleaveby(predicate=Base.isless, a, b)

Iterate over the an interleaving of a and b selected by the predicate (default less-than).

Input:

  • predicate(ak,bk) -> Bool: Whether to pick the next element of a (true) or b (false).
  • fa(ak), fb(bk): Functions to apply to the picked elements
julia> collect(interleaveby(1:2:5, 2:2:6))
+i = 9
source
IterTools.interleavebyFunction
interleaveby(predicate=Base.isless, a, b)

Iterate over the an interleaving of a and b selected by the predicate (default less-than).

Input:

  • predicate(ak,bk) -> Bool: Whether to pick the next element of a (true) or b (false).
  • fa(ak), fb(bk): Functions to apply to the picked elements
julia> collect(interleaveby(1:2:5, 2:2:6))
 6-element Vector{Int64}:
  1
  2
  3
  4
  5
- 6

If the predicate is Base.isless (the default) and both inputs are sorted, this produces the sorted output. If the predicate is a stateful functor that alternates true-false-true-false... then this produces the classic interleave operation as described e.g. in the definition of microkanren.

source
IterTools.iteratedMethod
iterated(f, x)

Iterate over successive applications of f, as in x, f(x), f(f(x)), f(f(f(x))), ...

Use Base.Iterators.take() to obtain the required number of elements.

julia> for i in Iterators.take(iterated(x -> 2x, 1), 5)
+ 6

If the predicate is Base.isless (the default) and both inputs are sorted, this produces the sorted output. If the predicate is a stateful functor that alternates true-false-true-false... then this produces the classic interleave operation as described e.g. in the definition of microkanren.

source
IterTools.iteratedMethod
iterated(f, x)

Iterate over successive applications of f, as in x, f(x), f(f(x)), f(f(f(x))), ...

Use Base.Iterators.take() to obtain the required number of elements.

julia> for i in Iterators.take(iterated(x -> 2x, 1), 5)
            @show i
        end
 i = 1
@@ -62,7 +62,7 @@
 i = 3.1622776601683795
 i = 1.7782794100389228
 i = 1.333521432163324
-i = 1.1547819846894583
source
IterTools.ivecMethod
ivec(iter)

Drops all shape from iter while iterating. Like a non-materializing version of vec.

julia> m = collect(reshape(1:6, 2, 3))
+i = 1.1547819846894583
source
IterTools.ivecMethod
ivec(iter)

Drops all shape from iter while iterating. Like a non-materializing version of vec.

julia> m = collect(reshape(1:6, 2, 3))
 2×3 Matrix{Int64}:
  1  3  5
  2  4  6
@@ -74,7 +74,7 @@
  3
  4
  5
- 6
source
IterTools.ncycleMethod
ncycle(iter, n)

Cycle through iter n times.

julia> for i in ncycle(1:3, 2)
+ 6
source
IterTools.ncycleMethod
ncycle(iter, n)

Cycle through iter n times.

julia> for i in ncycle(1:3, 2)
            @show i
        end
 i = 1
@@ -82,10 +82,10 @@
 i = 3
 i = 1
 i = 2
-i = 3
source
IterTools.nthMethod
nth(xs, n)

Return the nth element of xs. This is mostly useful for non-indexable collections.

julia> powers_of_two = iterated(x->2x,1);
+i = 3
source
IterTools.nthMethod
nth(xs, n)

Return the nth element of xs. This is mostly useful for non-indexable collections.

julia> powers_of_two = iterated(x->2x,1);
 
 julia> nth(powers_of_two, 4)
-8
source
IterTools.partitionMethod
partition(xs, n, [step])

Group values into n-tuples.

julia> for i in partition(1:9, 3)
+8
source
IterTools.partitionMethod
partition(xs, n, [step])

Group values into n-tuples.

julia> for i in partition(1:9, 3)
            @show i
        end
 i = (1, 2, 3)
@@ -110,7 +110,7 @@
        end
 i = (1, 2)
 i = (4, 5)
-i = (7, 8)
source
IterTools.peekiterMethod
peekiter(xs)

Lets you peek at the head element of an iterator without updating the state.

julia> it = peekiter(["face", "foo", "bar", "book", "baz", "zzz"]);
+i = (7, 8)
source
IterTools.peekiterMethod
peekiter(xs)

Lets you peek at the head element of an iterator without updating the state.

julia> it = peekiter(["face", "foo", "bar", "book", "baz", "zzz"]);
 
 julia> peek(it)
 Some("face")
@@ -125,13 +125,13 @@
 "face"
 
 julia> peek(it, s)
-Some("foo")
source
IterTools.propertiesMethod
properties(x)

Iterate through the names and value of the properties of x.

julia> collect(properties(1 + 2im))
+Some("foo")
source
IterTools.propertiesMethod
properties(x)

Iterate through the names and value of the properties of x.

julia> collect(properties(1 + 2im))
 2-element Vector{Any}:
  (:re, 1)
- (:im, 2)
source
IterTools.propertyvaluesMethod
propertyvalues(x)

Iterate through the values of the properties of x.

julia> collect(propertyvalues(1 + 2im))
+ (:im, 2)
source
IterTools.propertyvaluesMethod
propertyvalues(x)

Iterate through the values of the properties of x.

julia> collect(propertyvalues(1 + 2im))
 2-element Vector{Any}:
  1
- 2
source
IterTools.repeatedlyMethod
repeatedly(f)
+ 2
source
IterTools.repeatedlyMethod
repeatedly(f)
 repeatedly(f, n)

Call function f n times, or infinitely if n is omitted.

julia> t() = (sleep(0.1); Dates.millisecond(now()))
 t (generic function with 1 method)
 
@@ -141,7 +141,7 @@
   97
  200
  303
- 408
source
IterTools.subsetsMethod
subsets(xs)
+ 408
source
IterTools.subsetsMethod
subsets(xs)
 subsets(xs, k)
 subsets(xs, Val{k}())

Iterate over every subset of the indexable collection xs. You can restrict the subsets to a specific size k.

Giving the subset size in the form Val{k}() allows the compiler to produce code optimized for the particular size requested. This leads to performance comparable to hand-written loops if k is small and known at compile time, but may or may not improve performance otherwise.

julia> for i in subsets([1, 2, 3])
           @show i
@@ -173,19 +173,19 @@
 i = (1, 4)
 i = (2, 3)
 i = (2, 4)
-i = (3, 4)
source
IterTools.takenthMethod
takenth(xs, n)

Iterate through every nth element of xs.

julia> collect(takenth(5:15,3))
+i = (3, 4)
source
IterTools.takenthMethod
takenth(xs, n)

Iterate through every nth element of xs.

julia> collect(takenth(5:15,3))
 3-element Vector{Int64}:
   7
  10
- 13
source
IterTools.takestrictMethod
takestrict(xs, n::Int)

Like take(), an iterator that generates at most the first n elements of xs, but throws an exception if fewer than n items are encountered in xs.

julia> collect(takestrict(1:2:11, 3))
+ 13
source
IterTools.takestrictMethod
takestrict(xs, n::Int)

Like take(), an iterator that generates at most the first n elements of xs, but throws an exception if fewer than n items are encountered in xs.

julia> collect(takestrict(1:2:11, 3))
 3-element Vector{Int64}:
  1
  3
- 5
source
IterTools.takewhileMethod
takewhile(cond, xs)

An iterator that yields values from the iterator xs as long as the predicate cond is true.

julia> collect(takewhile(x-> x^2 < 10, 1:100))
+ 5
source
IterTools.takewhileMethod
takewhile(cond, xs)

An iterator that yields values from the iterator xs as long as the predicate cond is true.

julia> collect(takewhile(x-> x^2 < 10, 1:100))
 3-element Vector{Int64}:
  1
  2
- 3
source
IterTools.zip_longestMethod
zip_longest(iters...; default=nothing)

For one or more iterable objects, return an iterable of tuples, where the ith tuple contains the ith component of each input iterable if it is not finished, and default otherwise. default can be a scalar, or a tuple with one default per iterable.

julia> for t in zip_longest(1:2, 5:8)
+ 3
source
IterTools.zip_longestMethod
zip_longest(iters...; default=nothing)

For one or more iterable objects, return an iterable of tuples, where the ith tuple contains the ith component of each input iterable if it is not finished, and default otherwise. default can be a scalar, or a tuple with one default per iterable.

julia> for t in zip_longest(1:2, 5:8)
          @show t
        end
 t = (1, 5)
@@ -200,7 +200,7 @@
 t = ('b', 'n')
 t = ('c', 'x')
 t = ('d', 'x')
-t = ('e', 'x')
source
IterTools.@ifsomethingMacro
IterTools.@ifsomething expr

If expr evaluates to nothing, equivalent to return nothing, otherwise the macro evaluates to the value of expr. Not exported, useful for implementing iterators.

julia> IterTools.@ifsomething iterate(1:2)
+t = ('e', 'x')
source
IterTools.@ifsomethingMacro
IterTools.@ifsomething expr

If expr evaluates to nothing, equivalent to return nothing, otherwise the macro evaluates to the value of expr. Not exported, useful for implementing iterators.

julia> IterTools.@ifsomething iterate(1:2)
 (1, 1)
 
-julia> let elt, state = IterTools.@ifsomething iterate(1:2, 2); println("not reached"); end
source
+julia> let elt, state = IterTools.@ifsomething iterate(1:2, 2); println("not reached"); endsource