Remove superfluous update-path helper
This commit is contained in:
parent
6e06c4d502
commit
cbf5224599
|
@ -275,7 +275,7 @@ cases where handlers are dynamically installed.
|
||||||
walk-edge h node n_pop n_index (s:shapes) =
|
walk-edge h node n_pop n_index (s:shapes) =
|
||||||
let (n_pop', node') = walk-node h node n_pop n_index s
|
let (n_pop', node') = walk-node h node n_pop n_index s
|
||||||
let n_index' = n_index + 1
|
let n_index' = n_index + 1
|
||||||
let h' = update-path h 1 n_index'
|
let h' = (dropRight h 1) ++ [n_index']
|
||||||
walk-edge h' node' n_pop' n_index' shapes
|
walk-edge h' node' n_pop' n_index' shapes
|
||||||
|
|
||||||
walk-node :: H -> Node -> 𝐍 -> 𝐍 -> S -> (𝐍,Node)
|
walk-node :: H -> Node -> 𝐍 -> 𝐍 -> S -> (𝐍,Node)
|
||||||
|
@ -295,13 +295,9 @@ cases where handlers are dynamically installed.
|
||||||
classof (project v h) = class }
|
classof (project v h) = class }
|
||||||
edges[selector][class] := ((innercache, {}), {})
|
edges[selector][class] := ((innercache, {}), {})
|
||||||
let node' = edges[selector][class]
|
let node' = edges[selector][class]
|
||||||
let h' = update-path h 0 0
|
let h' = h ++ [0]
|
||||||
walk-edge h' node' 0 0 [s_0, ..., s_i]
|
walk-edge h' node' 0 0 [s_0, ..., s_i]
|
||||||
|
|
||||||
update-path :: H -> 𝐍 -> 𝐍 -> H
|
|
||||||
update-path h n_pop n_index =
|
|
||||||
(dropRight h n_pop) ++ [n_index]
|
|
||||||
|
|
||||||
**Definition.** The `addHandler` procedure installs into an index an
|
**Definition.** The `addHandler` procedure installs into an index an
|
||||||
event handler callback `f` expecting values matching and captured by
|
event handler callback `f` expecting values matching and captured by
|
||||||
the given skeleton `k`. It then invokes `f` once for each distinct
|
the given skeleton `k`. It then invokes `f` once for each distinct
|
||||||
|
|
|
@ -184,9 +184,6 @@
|
||||||
[(visibility-restriction p t) (values p t)]
|
[(visibility-restriction p t) (values p t)]
|
||||||
[other (values #f other)])))
|
[other (values #f other)])))
|
||||||
|
|
||||||
(define (update-path path pop-count index)
|
|
||||||
(append (drop-right path pop-count) (list index)))
|
|
||||||
|
|
||||||
(define (extend-skeleton! sk desc)
|
(define (extend-skeleton! sk desc)
|
||||||
(define (walk-node! path sk pop-count index desc)
|
(define (walk-node! path sk pop-count index desc)
|
||||||
(match desc
|
(match desc
|
||||||
|
@ -212,7 +209,7 @@
|
||||||
(hash-set! filtered a #t))))
|
(hash-set! filtered a #t))))
|
||||||
(make-empty-skeleton/cache filtered))
|
(make-empty-skeleton/cache filtered))
|
||||||
(define next (hash-ref! table class make-skeleton-node-with-cache))
|
(define next (hash-ref! table class make-skeleton-node-with-cache))
|
||||||
(walk-edge! (update-path path 0 0) next 0 0 pieces)]
|
(walk-edge! (append path '(0)) next 0 0 pieces)]
|
||||||
[_
|
[_
|
||||||
(values pop-count sk)]))
|
(values pop-count sk)]))
|
||||||
(define (walk-edge! path sk pop-count index pieces)
|
(define (walk-edge! path sk pop-count index pieces)
|
||||||
|
@ -221,7 +218,8 @@
|
||||||
(values (+ pop-count 1) sk)]
|
(values (+ pop-count 1) sk)]
|
||||||
[(cons p pieces)
|
[(cons p pieces)
|
||||||
(let-values (((pop-count sk) (walk-node! path sk pop-count index p)))
|
(let-values (((pop-count sk) (walk-node! path sk pop-count index p)))
|
||||||
(walk-edge! (update-path path 1 (+ index 1)) sk pop-count (+ index 1) pieces))]))
|
(define next-path (append (drop-right path 1) (list (+ index 1))))
|
||||||
|
(walk-edge! next-path sk pop-count (+ index 1) pieces))]))
|
||||||
(let-values (((_pop-count sk) (walk-node! '() sk 0 0 desc)))
|
(let-values (((_pop-count sk) (walk-node! '() sk 0 0 desc)))
|
||||||
sk))
|
sk))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue