graph-store: updated deep-node retrieval to use +tab

This commit is contained in:
Logan Allen 2021-05-05 17:25:13 -05:00
parent 01c5286319
commit 3cf35bc369

View File

@ -1041,35 +1041,34 @@
(~(get by graphs) [ship term]) (~(get by graphs) [ship term])
?~ result ?~ result
[~ ~] [~ ~]
=* graph p.u.result
=/ =(list [atom node:store]) (tap:orm graph)
:- ~ :- ~ :- %graph-update-2 :- ~ :- ~ :- %graph-update-2
!> ^- update:store !> ^- update:store
:- now.bowl :+ %0
now.bowl
:+ %add-nodes :+ %add-nodes
[ship term] [ship term]
=| deep-map=(map index:store node:store) =* a u.count
=| iter=@ud =/ b=(list (pair atom node:store))
=| =index:store (tab:orm p.u.result start u.count)
|- ^- (map index:store node:store) =| c=index:store
?: ?|(?=(~ list) =(iter count)) =| d=(map index:store node:store)
deep-map =| e=@ud
=* atom -.i.list =- d
=* node +.i.list |- ^- [e=@ud d=(map index:store node:store)]
=. index (snoc index atom) ?: ?|(?=(~ b) =(e a))
:: check children first, then check parent [e d]
=* atom p.i.b
=* node q.i.b
?- -.children.node ?- -.children.node
%empty %empty $(e +(e), d (~(put by d) c node))
=. deep-map (~(put by deep-map) index node(children [%empty ~]))
$(list t.list, iter +(iter), index ~)
:: ::
%graph %graph
=. deep-map $(list (tap:orm p.children.node)) =/ f $(c (snoc c atom), b (tab:orm p.children.node ~ (sub a e)))
=. iter ~(wyt by deep-map) ?: =(e.f a) f
?: =(iter count) %_ $
deep-map e +(e.f)
=. deep-map (~(put by deep-map) index node(children [%empty ~])) d (~(put by d.f) c node(children [%empty ~]))
$(list t.list, iter +(iter), index ~) ==
== ==
:: ::
[%x %update-log-subset @ @ @ @ ~] [%x %update-log-subset @ @ @ @ ~]