@@ -14,6 +14,42 @@ for sub-choicemaps. Leaf nodes have type:
1414ValueChoiceMap
1515```
1616
17+ ### Example Usage Overview
18+
19+ Choicemaps store values nested in a tree where each node posesses an address for each subtree.
20+ A leaf-node choicemap simply contains a value, and has it's value looked up via:
21+ ``` julia
22+ value = choicemap[]
23+ ```
24+ If a choicemap has a value choicemap at address ` :a ` , it is looked up via:
25+ ``` julia
26+ value = choicemap[:a ]
27+ ```
28+ And a choicemap may also have a non-value choicemap stored at a value. For instance,
29+ if a choicemap has another choicemap stored at address ` :a ` , and this internal choicemap
30+ has a valuechoicemap stored at address ` :b ` and another at ` :c ` , we could perform the following lookups:
31+ ``` julia
32+ value1 = choicemap[:a => :b ]
33+ value2 = choicemap[:a => :c ]
34+ ```
35+ Nesting can be arbitrarily deep, and the keys can be arbitrary values; for instance
36+ choicemaps can be constructed with values at the following nested addresses:
37+ ``` julia
38+ value = choicemap[:a => :b => :c => 4 => 1.63 => :e ]
39+ value = choicemap[:a => :b => :a => 2 => " alphabet" => :e ]
40+ ```
41+ To get a sub-choicemap, use ` get_submap ` :
42+ ``` julia
43+ value1 = choicemap[:a => :b ]
44+ submap = get_submap (choicemap, :a )
45+ value1 == submap[:b ] # is true
46+
47+ value_submap = get_submap (choicemap, :a => :b )
48+ value_submap[] == value1 # is true
49+ ```
50+
51+ ### Interface
52+
1753Choice maps provide the following methods:
1854``` @docs
1955get_submap
@@ -58,7 +94,7 @@ set_value!
5894set_submap!
5995```
6096
61- ## Implementing custom choicemap types
97+ ### Implementing custom choicemap types
6298
6399To implement a custom choicemap, one must implement
64100` get_submap ` and ` get_submaps_shallow ` .
0 commit comments