dummy-link

LayerDicts

Layered dictionary lookups for Julia

Readme

LayerDicts

CI CodeCov

LayerDict is an Associative type that wraps a series of other associatives (e.g. Dicts). When performing a lookup, a LayerDict will look through its associatives in the order they were passed to the constructor until it finds a match. LayerDicts are immutable—you cannot call setindex! on them. However, you can update its wrapped associatives and those changes will be reflected in future lookups.

Example

using LayerDicts

dict1 = Dict{Symbol, Int}(:foo => 1, :bar => 1)
dict2 = Dict{Symbol, Int}()
dict3 = Dict{Symbol, Int}(:bar => 3, :baz => 3)

ld = LayerDict([dict1, dict2, dict3])
@assert ld[:foo] == 1
@assert ld[:bar] == 1
@assert ld[:baz] == 3
ld[:quuz]  # throws a KeyError

First Commit

12/04/2017

Last Touched

about 1 month ago

Commits

29 commits

Requires:

Used By: