Update HOWITWORKS.md for extensible record matching
This commit is contained in:
parent
6d1278fbb0
commit
ba2bd81f3d
|
@ -187,7 +187,7 @@ functions and caches of currently-asserted values.
|
||||||
Index = Bag(V) × Node
|
Index = Bag(V) × Node
|
||||||
Node = Continuation × (Selector ⟼ Class ⟼ Node)
|
Node = Continuation × (Selector ⟼ Class ⟼ Node)
|
||||||
Selector = 𝐍 × 𝐍 -- pop-count and index
|
Selector = 𝐍 × 𝐍 -- pop-count and index
|
||||||
Class = X × 𝐍 -- label and arity
|
Class = X -- label
|
||||||
|
|
||||||
Continuation = 𝒫(V) × ([H] ⟼ [V] ⟼ Leaf)
|
Continuation = 𝒫(V) × ([H] ⟼ [V] ⟼ Leaf)
|
||||||
Leaf = 𝒫(V) × ([H] ⟼ Handler)
|
Leaf = 𝒫(V) × ([H] ⟼ Handler)
|
||||||
|
@ -253,12 +253,11 @@ cases where handlers are dynamically installed.
|
||||||
projectMany v [h_0, ...] = [project v h_0, ...]
|
projectMany v [h_0, ...] = [project v h_0, ...]
|
||||||
|
|
||||||
**Definition.** The `classof` function extracts the constructor label
|
**Definition.** The `classof` function extracts the constructor label
|
||||||
`x` and its arity `i` from a value `v`, yielding `()` if `v` is not
|
`x` from a value `v`, yielding `()` if `v` is not a record.
|
||||||
a record.
|
|
||||||
|
|
||||||
classof :: V -> 1 + Class
|
classof :: V -> 1 + Class
|
||||||
classof a = ()
|
classof a = ()
|
||||||
classof x(v_0, ..., v_i) = (x,i)
|
classof x(v_0, ..., v_i) = x
|
||||||
|
|
||||||
**Definition.** The `extend` procedure augments an index with shape
|
**Definition.** The `extend` procedure augments an index with shape
|
||||||
information `s`, by imperatively updating the index structure. It
|
information `s`, by imperatively updating the index structure. It
|
||||||
|
@ -286,7 +285,7 @@ cases where handlers are dynamically installed.
|
||||||
walk-node h node n_pop n_index x(s_0, ... s_i) =
|
walk-node h node n_pop n_index x(s_0, ... s_i) =
|
||||||
let (cont, edges) = node
|
let (cont, edges) = node
|
||||||
let selector = (n_pop,n_index)
|
let selector = (n_pop,n_index)
|
||||||
let class = (x,i)
|
let class = x
|
||||||
if selector not in edges then
|
if selector not in edges then
|
||||||
edges[selector] := {}
|
edges[selector] := {}
|
||||||
let table = edges[selector]
|
let table = edges[selector]
|
||||||
|
|
Loading…
Reference in New Issue