Remove superfluous update-path helper

This commit is contained in:
Tony Garnock-Jones 2018-10-20 19:13:07 +01:00
parent 6e06c4d502
commit cbf5224599
2 changed files with 5 additions and 11 deletions

View File

@ -275,7 +275,7 @@ cases where handlers are dynamically installed.
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_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-node :: H -> Node -> 𝐍 -> 𝐍 -> S -> (𝐍,Node)
@ -295,13 +295,9 @@ cases where handlers are dynamically installed.
classof (project v h) = class }
edges[selector][class] := ((innercache, {}), {})
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]
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
event handler callback `f` expecting values matching and captured by
the given skeleton `k`. It then invokes `f` once for each distinct

View File

@ -184,9 +184,6 @@
[(visibility-restriction p t) (values p t)]
[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 (walk-node! path sk pop-count index desc)
(match desc
@ -212,7 +209,7 @@
(hash-set! filtered a #t))))
(make-empty-skeleton/cache filtered))
(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)]))
(define (walk-edge! path sk pop-count index pieces)
@ -221,7 +218,8 @@
(values (+ pop-count 1) sk)]
[(cons p pieces)
(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)))
sk))