Fix set inclusion

This commit is contained in:
Emery Hemingway 2024-05-06 13:28:33 +02:00
parent c40d2c6443
commit f65e206864
1 changed files with 3 additions and 0 deletions

View File

@ -249,10 +249,13 @@ proc `[]=`*(pr: var Value; key, val: Value) =
proc incl*(pr: var Value; key: Value) =
## Include `key` in the Preserves set `pr`.
# TODO: binary search
for i in 0..pr.set.high:
if key < pr.set[i]:
insert(pr.set, [key], i)
return
elif key == pr.set[i]:
return
pr.set.add(key)
proc excl*(pr: var Value; key: Value) =