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
|
||||
Node = Continuation × (Selector ⟼ Class ⟼ Node)
|
||||
Selector = 𝐍 × 𝐍 -- pop-count and index
|
||||
Class = X × 𝐍 -- label and arity
|
||||
Class = X -- label
|
||||
|
||||
Continuation = 𝒫(V) × ([H] ⟼ [V] ⟼ Leaf)
|
||||
Leaf = 𝒫(V) × ([H] ⟼ Handler)
|
||||
|
@ -253,12 +253,11 @@ cases where handlers are dynamically installed.
|
|||
projectMany v [h_0, ...] = [project v h_0, ...]
|
||||
|
||||
**Definition.** The `classof` function extracts the constructor label
|
||||
`x` and its arity `i` from a value `v`, yielding `()` if `v` is not
|
||||
a record.
|
||||
`x` from a value `v`, yielding `()` if `v` is not a record.
|
||||
|
||||
classof :: V -> 1 + Class
|
||||
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
|
||||
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) =
|
||||
let (cont, edges) = node
|
||||
let selector = (n_pop,n_index)
|
||||
let class = (x,i)
|
||||
let class = x
|
||||
if selector not in edges then
|
||||
edges[selector] := {}
|
||||
let table = edges[selector]
|
||||
|
|
Loading…
Reference in New Issue