graph-store: use +lien instead of manual recursion

This commit is contained in:
Logan Allen 2021-04-14 15:39:34 -05:00
parent b319928059
commit 45fb7e69f3

View File

@ -215,27 +215,27 @@
++ check-for-duplicates ++ check-for-duplicates
|= [=graph:store nodes=(set index:store)] |= [=graph:store nodes=(set index:store)]
^- ? ^- ?
=/ node-list ~(tap in nodes) |^
|- %+ lien ~(tap in nodes)
?~ node-list %.n |= =index:store
?: (has-node graph i.node-list) %.y (has-node graph index)
$(node-list t.node-list) ::
:: ++ has-node
++ has-node |= [=graph:store =index:store]
|= [=graph:store =index:store] ^- ?
^- ? =/ node=(unit node:store) ~
=/ node=(unit node:store) ~ |-
|- ?~ index
?~ index ?=(^ node)
?=(^ node) ?~ t.index
?~ t.index ?=(^ (get:orm graph i.index))
?=(^ (get:orm graph i.index)) =. node (get:orm graph i.index)
=. node (get:orm graph i.index) ?~ node %.n
?~ node %.n ?- -.children.u.node
?- -.children.u.node %empty %.n
%empty %.n %graph $(graph p.children.u.node, index t.index)
%graph $(graph p.children.u.node, index t.index) ==
== --
:: ::
++ sort-nodes ++ sort-nodes
|= nodes=(map index:store node:store) |= nodes=(map index:store node:store)