graph-store: no need to iterate through whole list if we find a single duplicate

This commit is contained in:
Logan Allen 2020-12-11 18:13:47 -06:00
parent 78cf4443c2
commit 386997475b

View File

@ -316,13 +316,10 @@
++ check-for-duplicates
|= [=graph:store nodes=(set index:store)]
^- ?
=/ has-duplicates %.n
=/ node-list ~(tap in nodes)
|-
?~ node-list
has-duplicates
=. has-duplicates
|(has-duplicates (has-node graph i.node-list))
?~ node-list %.n
?: (has-node graph i.node-list) %.y
$(node-list t.node-list)
::
++ has-node