From 0cd949f7ae8f38717301b137a7bfeb0a72e76f44 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 5 Jan 2024 12:42:10 +0000 Subject: [PATCH] build based on d0b2ccc --- dev/docstrings/index.html | 40 +++++++++++++-------------- dev/examples/custom_macros/index.html | 2 +- dev/examples/custom_optics/index.html | 2 +- dev/examples/molecules/index.html | 2 +- dev/examples/specter/index.html | 4 +-- dev/getting_started/index.html | 2 +- dev/index.html | 2 +- dev/internals/index.html | 8 +++--- dev/lenses/index.html | 2 +- dev/search/index.html | 2 +- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/dev/docstrings/index.html b/dev/docstrings/index.html index 292f583b..fa23c4aa 100644 --- a/dev/docstrings/index.html +++ b/dev/docstrings/index.html @@ -7,13 +7,13 @@ (0, 0, 0) julia> modify(x -> 2x, obj, Elements()) -(2, 4, 6)

This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.IfType
If(modify_condition)

Restric access to locations for which modify_condition holds.

julia> using Accessors
+(2, 4, 6)

This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.IfType
If(modify_condition)

Restric access to locations for which modify_condition holds.

julia> using Accessors
 
 julia> obj = (1,2,3,4,5,6);
 
 julia> @set obj |> Elements() |> If(iseven) *= 10
-(1, 20, 3, 40, 5, 60)

This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.IndexLensMethod
IndexLens(indices::Tuple)
-IndexLens(indices::Integer...)

Construct a lens for accessing an element of an object at indices via [].

source
Accessors.PropertiesType
Properties()

Access all properties of an objects.

julia> using Accessors
+(1, 20, 3, 40, 5, 60)

This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.IndexLensMethod
IndexLens(indices::Tuple)
+IndexLens(indices::Integer...)

Construct a lens for accessing an element of an object at indices via [].

source
Accessors.PropertiesType
Properties()

Access all properties of an objects.

julia> using Accessors
 
 julia> obj = (a=1, b=2, c=3)
 (a = 1, b = 2, c = 3)
@@ -22,8 +22,8 @@
 (a = "hi", b = "hi", c = "hi")
 
 julia> modify(x -> 2x, obj, Properties())
-(a = 2, b = 4, c = 6)

Based on mapproperties.

This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.PropertyLensMethod
PropertyLens{fieldname}()
-PropertyLens(fieldname)

Construct a lens for accessing a property fieldname of an object.

The second constructor may not be type stable when fieldname is not a constant.

source
Accessors.RecursiveType
Recursive(descent_condition, optic)

Apply optic recursively as long as descent_condition holds.

julia> using Accessors
+(a = 2, b = 4, c = 6)

Based on mapproperties.

This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.PropertyLensMethod
PropertyLens{fieldname}()
+PropertyLens(fieldname)

Construct a lens for accessing a property fieldname of an object.

The second constructor may not be type stable when fieldname is not a constant.

source
Accessors.RecursiveType
Recursive(descent_condition, optic)

Apply optic recursively as long as descent_condition holds.

julia> using Accessors
 
 julia> obj = (a=missing, b=1, c=(d=missing, e=(f=missing, g=2)))
 (a = missing, b = 1, c = (d = missing, e = (f = missing, g = 2)))
@@ -35,12 +35,12 @@
 (1, 2, (3, (4, 5), 6))
 
 julia> modify(x -> 100x, obj, Recursive(x -> (x isa Tuple), Elements()))
-(100, 200, (300, (400, 500), 600))
source
Accessors.deleteFunction
delete(obj, optic)

Delete a part according to optic of obj.

julia> using Accessors
+(100, 200, (300, (400, 500), 600))
source
Accessors.deleteFunction
delete(obj, optic)

Delete a part according to optic of obj.

julia> using Accessors
 
 julia> obj = (a=1, b=2); lens=@optic _.a;
 
 julia> delete(obj, lens)
-(b = 2,)
source
Accessors.getallFunction
getall(obj, optic)

Extract all parts of obj that are selected by optic. Returns a flat Tuple of values, or an AbstractVector if the selected parts contain arrays.

This function is experimental and we might change the precise output container in the future.

See also setall.

julia> using Accessors
+(b = 2,)
source
Accessors.getallFunction
getall(obj, optic)

Extract all parts of obj that are selected by optic. Returns a flat Tuple of values, or an AbstractVector if the selected parts contain arrays.

This function is experimental and we might change the precise output container in the future.

See also setall.

julia> using Accessors
 
 julia> obj = (a=1, b=(2, 3));
 
@@ -48,22 +48,22 @@
 (1,)
 
 julia> getall(obj, @optic _ |> Elements() |> last)
-(1, 3)
source
Accessors.insertFunction
insert(obj, optic, val)

Insert a part according to optic into obj with the value val.

julia> using Accessors
+(1, 3)
source
Accessors.insertFunction
insert(obj, optic, val)

Insert a part according to optic into obj with the value val.

julia> using Accessors
 
 julia> obj = (a=1, b=2); lens=@optic _.c; val = 100;
 
 julia> insert(obj, lens, val)
-(a = 1, b = 2, c = 100)

See also set.

source
Accessors.modifyFunction
modify(f, obj, optic)

Replace a part x of obj by f(x). The optic argument selects which part to replace.

julia> using Accessors
+(a = 1, b = 2, c = 100)

See also set.

source
Accessors.modifyFunction
modify(f, obj, optic)

Replace a part x of obj by f(x). The optic argument selects which part to replace.

julia> using Accessors
 
 julia> obj = (a=1, b=2); optic=@optic _.a; f = x -> "hello $x";
 
 julia> modify(f, obj, optic)
-(a = "hello 1", b = 2)

See also set.

source
Accessors.setFunction
set(obj, optic, val)

Replace a part according to optic of obj by val.

julia> using Accessors
+(a = "hello 1", b = 2)

See also set.

source
Accessors.setFunction
set(obj, optic, val)

Replace a part according to optic of obj by val.

julia> using Accessors
 
 julia> obj = (a=1, b=2); lens=@optic _.a; val = 100;
 
 julia> set(obj, lens, val)
-(a = 100, b = 2)

See also modify.

source
Accessors.setallFunction
setall(obj, optic, values)

Replace a part of obj that is selected by optic with values. The values collection should have the same number of elements as selected by optic.

This function is experimental and might change in the future.

See also getall, set. The former is dual to setall:

julia> using Accessors
+(a = 100, b = 2)

See also modify.

source
Accessors.setallFunction
setall(obj, optic, values)

Replace a part of obj that is selected by optic with values. The values collection should have the same number of elements as selected by optic.

This function is experimental and might change in the future.

See also getall, set. The former is dual to setall:

julia> using Accessors
 
 julia> obj = (a=1, b=(2, 3));
 
@@ -73,7 +73,7 @@
 (1, 3)
 
 julia> setall(obj, optic, (4, 5))
-(a = 4, b = (2, 5))
source
CompositionsBase.opcomposeFunction
optic₁ ⨟ optic₂

Compose optics optic₁, optic₂, ..., opticₙ to access nested objects.

Example

julia> using Accessors
+(a = 4, b = (2, 5))
source
CompositionsBase.opcomposeFunction
optic₁ ⨟ optic₂

Compose optics optic₁, optic₂, ..., opticₙ to access nested objects.

Example

julia> using Accessors
 
 julia> obj = (a = (b = (c = 1,),),);
 
@@ -84,18 +84,18 @@
 (@optic _.c) ∘ (@optic _.a.b)
 
 julia> lens(obj)
-1
source
Accessors.@accessorMacro
@accessor func

Given a simple getter function, define the corresponding set method automatically.

Example

julia> @accessor my_func(x) = x.a
+1
source
Accessors.@accessorMacro
@accessor func

Given a simple getter function, define the corresponding set method automatically.

Example

julia> @accessor my_func(x) = x.a
 
 julia> my_func((a=1, b=2))
 1
 
 julia> set((a=1, b=2), my_func, 100)
-(a = 100, b = 2)
source
Accessors.@deleteMacro
@delete obj_optic

Define an optic and call delete on it.

julia> using Accessors
+(a = 100, b = 2)
source
Accessors.@deleteMacro
@delete obj_optic

Define an optic and call delete on it.

julia> using Accessors
 
 julia> xs = (1,2,3);
 
 julia> ys = @delete xs[2]
-(1, 3)

Supports the same syntax as @optic. See also @set.

source
Accessors.@insertMacro
@insert assignment

Return a modified copy of deeply nested objects.

Example

julia> using Accessors
+(1, 3)

Supports the same syntax as @optic. See also @set.

source
Accessors.@insertMacro
@insert assignment

Return a modified copy of deeply nested objects.

Example

julia> using Accessors
 
 julia> t = (a=1, b=2);
 
@@ -103,14 +103,14 @@
 (a = 1, b = 2, c = 5)
 
 julia> t
-(a = 1, b = 2)

Supports the same syntax as @optic. See also @set.

source
Accessors.@modifyMacro
@modify(f, obj_optic)

Define an optic and call modify on it.

julia> using Accessors
+(a = 1, b = 2)

Supports the same syntax as @optic. See also @set.

source
Accessors.@modifyMacro
@modify(f, obj_optic)

Define an optic and call modify on it.

julia> using Accessors
 
 julia> xs = (1,2,3);
 
 julia> ys = @modify(xs |> Elements() |> If(isodd)) do x
            x + 1
        end
-(2, 2, 4)

Supports the same syntax as @optic. See also @set.

source
Accessors.@opticMacro
@optic

Construct an optic from property access and similar.

Example

julia> using Accessors
+(2, 2, 4)

Supports the same syntax as @optic. See also @set.

source
Accessors.@opticMacro
@optic

Construct an optic from property access and similar.

Example

julia> using Accessors
 
 julia> struct T;a;b;end
 
@@ -130,7 +130,7 @@
 ("one", "two")
 
 julia> set(t, (@optic _[1]), "1")
-("1", "two")

See also @set.

source
Accessors.@resetMacro
@reset assignment

Shortcut for obj = @set obj....

Example

julia> using Accessors
+("1", "two")

See also @set.

source
Accessors.@resetMacro
@reset assignment

Shortcut for obj = @set obj....

Example

julia> using Accessors
 
 julia> t = (a=1,)
 (a = 1,)
@@ -139,7 +139,7 @@
 (a = 2,)
 
 julia> t
-(a = 2,)

Supports the same syntax as @optic. See also @set.

source
Accessors.@setMacro
@set assignment

Return a modified copy of deeply nested objects.

Example

julia> using Accessors
+(a = 2,)

Supports the same syntax as @optic. See also @set.

source
Accessors.@setMacro
@set assignment

Return a modified copy of deeply nested objects.

Example

julia> using Accessors
 
 julia> struct T;a;b end
 
@@ -156,4 +156,4 @@
 T(T(2, 2), 2)
 
 julia> @set t.a.b = 3
-T(T(2, 3), 2)

Supports the same syntax as @optic. See also @reset.

source
+T(T(2, 3), 2)

Supports the same syntax as @optic. See also @reset.

source diff --git a/dev/examples/custom_macros/index.html b/dev/examples/custom_macros/index.html index d674d704..af81ee81 100644 --- a/dev/examples/custom_macros/index.html +++ b/dev/examples/custom_macros/index.html @@ -68,4 +68,4 @@ set(o, l, 100) @test o == (foo=[100,2,3], bar=:bar)
Test Passed
   Expression: o == (foo = [100, 2, 3], bar = :bar)
-   Evaluated: (foo = [100, 2, 3], bar = :bar) == (foo = [100, 2, 3], bar = :bar)

Everything works, we can do arbitrary nesting and also use += syntax etc.


This page was generated using Literate.jl.

+ Evaluated: (foo = [100, 2, 3], bar = :bar) == (foo = [100, 2, 3], bar = :bar)

Everything works, we can do arbitrary nesting and also use += syntax etc.


This page was generated using Literate.jl.

diff --git a/dev/examples/custom_optics/index.html b/dev/examples/custom_optics/index.html index cdfe98aa..d2194093 100644 --- a/dev/examples/custom_optics/index.html +++ b/dev/examples/custom_optics/index.html @@ -37,4 +37,4 @@ obj2 = @modify(lowercase, obj |> Keys()) @test obj2 == Dict("a" =>1, "b" => 2, "c" => 3)
Test Passed
   Expression: obj2 == Dict("a" => 1, "b" => 2, "c" => 3)
-   Evaluated: Dict("c" => 3, "b" => 2, "a" => 1) == Dict("c" => 3, "b" => 2, "a" => 1)

This page was generated using Literate.jl.

+ Evaluated: Dict("c" => 3, "b" => 2, "a" => 1) == Dict("c" => 3, "b" => 2, "a" => 1)

This page was generated using Literate.jl.

diff --git a/dev/examples/molecules/index.html b/dev/examples/molecules/index.html index a4c5a02f..a7a3a3be 100644 --- a/dev/examples/molecules/index.html +++ b/dev/examples/molecules/index.html @@ -42,4 +42,4 @@ ) @test res_expected == res_set
Test Passed
   Expression: res_expected == res_set
-   Evaluated: (name = "water", atoms = NamedTuple{(:name, :position), Tuple{String, NamedTuple{(:x, :y), Tuple{Float64, Int64}}}}[(name = "H", position = (x = 4.0, y = 1)), (name = "O", position = (x = 4.0, y = 0)), (name = "H", position = (x = 4.0, y = 0))]) == (name = "water", atoms = NamedTuple{(:name, :position), Tuple{String, NamedTuple{(:x, :y), Tuple{Float64, Int64}}}}[(name = "H", position = (x = 4.0, y = 1)), (name = "O", position = (x = 4.0, y = 0)), (name = "H", position = (x = 4.0, y = 0))])

This page was generated using Literate.jl.

+ Evaluated: (name = "water", atoms = NamedTuple{(:name, :position), Tuple{String, NamedTuple{(:x, :y), Tuple{Float64, Int64}}}}[(name = "H", position = (x = 4.0, y = 1)), (name = "O", position = (x = 4.0, y = 0)), (name = "H", position = (x = 4.0, y = 0))]) == (name = "water", atoms = NamedTuple{(:name, :position), Tuple{String, NamedTuple{(:x, :y), Tuple{Float64, Int64}}}}[(name = "H", position = (x = 4.0, y = 1)), (name = "O", position = (x = 4.0, y = 0)), (name = "H", position = (x = 4.0, y = 0))])

This page was generated using Literate.jl.

diff --git a/dev/examples/specter/index.html b/dev/examples/specter/index.html index 4a0d98c1..b0fc28b7 100644 --- a/dev/examples/specter/index.html +++ b/dev/examples/specter/index.html @@ -11,7 +11,7 @@ struct Vals end OpticStyle(::Type{Vals}) = ModifyBased() -modify(f, obj, ::Vals) = mapvals(f, obj)
modify (generic function with 9 methods)

Now we can increment as follows:

out = @set data |> Vals() |> Elements() |> Vals() |> If(iseven) += 1
+modify(f, obj, ::Vals) = mapvals(f, obj)
modify (generic function with 11 methods)

Now we can increment as follows:

out = @set data |> Vals() |> Elements() |> Vals() |> If(iseven) += 1
 
 @test out == (a = [(aa = 1, bb = 3), (cc = 3,)], b = [(dd = 5,)])
Test Passed
   Expression: out == (a = [(aa = 1, bb = 3), (cc = 3,)], b = [(dd = 5,)])
@@ -54,4 +54,4 @@
 out = optic(data)
 @test out == [1,2,3]
Test Passed
   Expression: out == [1, 2, 3]
-   Evaluated: Union{Missing, Int64}[1, 2, 3] == [1, 2, 3]

This page was generated using Literate.jl.

+ Evaluated: Union{Missing, Int64}[1, 2, 3] == [1, 2, 3]

This page was generated using Literate.jl.

diff --git a/dev/getting_started/index.html b/dev/getting_started/index.html index 4d7317a6..cf1851a6 100644 --- a/dev/getting_started/index.html +++ b/dev/getting_started/index.html @@ -44,4 +44,4 @@ (a = (b = (1, 20),), c = 3) julia> @set splitext("some_file.py")[2] = ".jl" -"some_file.jl" +"some_file.jl" diff --git a/dev/index.html b/dev/index.html index 64102cfa..79ba81f9 100644 --- a/dev/index.html +++ b/dev/index.html @@ -13,4 +13,4 @@ (a = 1, b = 4) julia> nt -(a = 1, b = 4)

For more detail, see this tutorial and/or watch this video:

JuliaCon2020 Changing the immutable

Featured extensions

+(a = 1, b = 4)

For more detail, see this tutorial and/or watch this video:

JuliaCon2020 Changing the immutable

Featured extensions

diff --git a/dev/internals/index.html b/dev/internals/index.html index 396262fb..e356f7e1 100644 --- a/dev/internals/index.html +++ b/dev/internals/index.html @@ -4,17 +4,17 @@ end macro myinsert(ex) insertmacro(mytransform, ex) -end

See also opticmacro, setmacro.

source
Accessors.mappropertiesMethod
mapproperties(f, obj)

Construct a copy of obj, with each property replaced by the result of applying f to it.

julia> using Accessors
+end

See also opticmacro, setmacro.

source
Accessors.mappropertiesMethod
mapproperties(f, obj)

Construct a copy of obj, with each property replaced by the result of applying f to it.

julia> using Accessors
 
 julia> obj = (a=1, b=2);
 
 julia> Accessors.mapproperties(x -> x+1, obj)
-(a = 2, b = 3)

Implementation

This function should not be overloaded directly. Instead both of

  • ConstructionBase.getproperties
  • ConstructionBase.setproperties

should be overloaded. This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.opticcomposeMethod
opticcompose([optic₁, [optic₂, [optic₃, ...]]])

Compose optic₁, optic₂ etc. There is one subtle point here: While the two composition orders (optic₁ ⨟ optic₂) ⨟ optic₃ and optic₁ ⨟ (optic₂ ⨟ optic₃) have equivalent semantics, their performance may not be the same.

The opticcompose function tries to use a composition order, that the compiler likes. The composition order is therefore not part of the stable API.

source
Accessors.opticmacroMethod
opticmacro(optictransform, ex::Expr)

This function can be used to create a customized variant of @optic. It works by applying optictransform to the created optic at runtime.

# new_optic = mytransform(optic)
+(a = 2, b = 3)

Implementation

This function should not be overloaded directly. Instead both of

  • ConstructionBase.getproperties
  • ConstructionBase.setproperties

should be overloaded. This function/method/type is experimental. It can be changed or deleted at any point without warning

source
Accessors.opticcomposeMethod
opticcompose([optic₁, [optic₂, [optic₃, ...]]])

Compose optic₁, optic₂ etc. There is one subtle point here: While the two composition orders (optic₁ ⨟ optic₂) ⨟ optic₃ and optic₁ ⨟ (optic₂ ⨟ optic₃) have equivalent semantics, their performance may not be the same.

The opticcompose function tries to use a composition order, that the compiler likes. The composition order is therefore not part of the stable API.

source
Accessors.opticmacroMethod
opticmacro(optictransform, ex::Expr)

This function can be used to create a customized variant of @optic. It works by applying optictransform to the created optic at runtime.

# new_optic = mytransform(optic)
 macro myoptic(ex)
     opticmacro(mytransform, ex)
-end

See also setmacro.

source
Accessors.setmacroMethod
setmacro(optictransform, ex::Expr; overwrite::Bool=false)

This function can be used to create a customized variant of @set. It works by applying optictransform to the optic that is used in the customized @set macro at runtime.

Example

function mytransform(optic::Lens)::Lens
+end

See also setmacro.

source
Accessors.setmacroMethod
setmacro(optictransform, ex::Expr; overwrite::Bool=false)

This function can be used to create a customized variant of @set. It works by applying optictransform to the optic that is used in the customized @set macro at runtime.

Example

function mytransform(optic::Lens)::Lens
     ...
 end
 macro myset(ex)
     setmacro(mytransform, ex)
-end

See also opticmacro.

source
+end

See also opticmacro.

source diff --git a/dev/lenses/index.html b/dev/lenses/index.html index f88103ca..73161c0c 100644 --- a/dev/lenses/index.html +++ b/dev/lenses/index.html @@ -38,4 +38,4 @@ @assert set(obj, lens, lens(obj)) ≅ obj # Setting what was already there changes nothing. @assert set(set(obj, lens, val1), lens, val2) ≅ set(obj, lens, val2) - # The last set wins.

Here is an appropriate notion of equality or an approximation of it. In most contexts this is simply ==. But in some contexts it might be ===, , isequal or something else instead. For instance == does not work in Float64 context, because get(set(obj, lens, NaN), lens) == NaN can never hold. Instead isequal or ≅(x::Float64, y::Float64) = isequal(x,y) | x ≈ y are possible alternatives.

See also @optic, set, modify.

+ # The last set wins.

Here is an appropriate notion of equality or an approximation of it. In most contexts this is simply ==. But in some contexts it might be ===, , isequal or something else instead. For instance == does not work in Float64 context, because get(set(obj, lens, NaN), lens) == NaN can never hold. Instead isequal or ≅(x::Float64, y::Float64) = isequal(x,y) | x ≈ y are possible alternatives.

See also @optic, set, modify.

diff --git a/dev/search/index.html b/dev/search/index.html index b3da9af4..f85b1aeb 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · Accessors.jl

Loading search...

    +Search · Accessors.jl

    Loading search...