Browse Source

Remove superfluous update-path helper

fruit
Tony Garnock-Jones 4 years ago
parent
commit
cbf5224599
  1. 8
      syndicate/HOWITWORKS.md
  2. 8
      syndicate/skeleton.rkt

8
syndicate/HOWITWORKS.md

@ -275,7 +275,7 @@ cases where handlers are dynamically installed. @@ -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. @@ -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

8
syndicate/skeleton.rkt

@ -184,9 +184,6 @@ @@ -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 @@ @@ -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 @@ @@ -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))

Loading…
Cancel
Save