@@ -857,12 +857,12 @@ function dict_to_optic(dict)
857
857
end
858
858
end
859
859
860
- vn_to_dict (vn:: VarName ) = Dict (" sym" => getsym (vn), " optic" => optic_to_dict (getoptic (vn)))
860
+ varname_to_dict (vn:: VarName ) = Dict (" sym" => getsym (vn), " optic" => optic_to_dict (getoptic (vn)))
861
861
862
- dict_to_vn (dict:: Dict{<:AbstractString, Any} ) = VarName {Symbol(dict["sym"])} (dict_to_optic (dict[" optic" ]))
862
+ dict_to_varname (dict:: Dict{<:AbstractString, Any} ) = VarName {Symbol(dict["sym"])} (dict_to_optic (dict[" optic" ]))
863
863
864
864
"""
865
- vn_to_string (vn::VarName)
865
+ varname_to_string (vn::VarName)
866
866
867
867
Convert a `VarName` as a string, via an intermediate dictionary. This differs
868
868
from `string(vn)` in that concretised slices are faithfully represented (rather
@@ -875,25 +875,25 @@ if you are using custom index types, you will need to implement the
875
875
documentation of [`dict_to_index`](@ref) for instructions on how to do this.
876
876
877
877
```jldoctest
878
- julia> vn_to_string (@varname(x))
878
+ julia> varname_to_string (@varname(x))
879
879
"{\\ "optic\\ ":{\\ "type\\ ":\\ "identity\\ "},\\ "sym\\ ":\\ "x\\ "}"
880
880
881
- julia> vn_to_string (@varname(x.a))
881
+ julia> varname_to_string (@varname(x.a))
882
882
"{\\ "optic\\ ":{\\ "field\\ ":\\ "a\\ ",\\ "type\\ ":\\ "property\\ "},\\ "sym\\ ":\\ "x\\ "}"
883
883
884
- julia> y = ones(2); vn_to_string (@varname(y[:]))
884
+ julia> y = ones(2); varname_to_string (@varname(y[:]))
885
885
"{\\ "optic\\ ":{\\ "indices\\ ":{\\ "values\\ ":[{\\ "type\\ ":\\ "Base.Colon\\ "}],\\ "type\\ ":\\ "Base.Tuple\\ "},\\ "type\\ ":\\ "index\\ "},\\ "sym\\ ":\\ "y\\ "}"
886
886
887
- julia> y = ones(2); vn_to_string (@varname(y[:], true))
887
+ julia> y = ones(2); varname_to_string (@varname(y[:], true))
888
888
"{\\ "optic\\ ":{\\ "indices\\ ":{\\ "values\\ ":[{\\ "range\\ ":{\\ "stop\\ ":2,\\ "type\\ ":\\ "Base.OneTo\\ "},\\ "type\\ ":\\ "AbstractPPL.ConcretizedSlice\\ "}],\\ "type\\ ":\\ "Base.Tuple\\ "},\\ "type\\ ":\\ "index\\ "},\\ "sym\\ ":\\ "y\\ "}"
889
889
```
890
890
"""
891
- vn_to_string (vn:: VarName ) = JSON. json (vn_to_dict (vn))
891
+ varname_to_string (vn:: VarName ) = JSON. json (varname_to_dict (vn))
892
892
893
893
"""
894
- vn_from_string (str::AbstractString)
894
+ string_to_varname (str::AbstractString)
895
895
896
896
Convert a string representation of a `VarName` back to a `VarName`. The string
897
- should have been generated by `vn_to_string `.
897
+ should have been generated by `varname_to_string `.
898
898
"""
899
- vn_from_string (str:: AbstractString ) = dict_to_vn (JSON. parse (str))
899
+ string_to_varname (str:: AbstractString ) = dict_to_varname (JSON. parse (str))
0 commit comments