Fix functional updates.
This commit is contained in:
parent
3f6c5cc36a
commit
f3bcfcaa6a
2 changed files with 9 additions and 3 deletions
|
@ -116,7 +116,7 @@
|
|||
(lambda (acc id mr)
|
||||
(cons (cons id mr) acc))
|
||||
mb1)))
|
||||
(list->bdict (sort mb (lambda (a b) (< (car a) (car b))))))))))))
|
||||
(list->bdict mb))))))))
|
||||
|
||||
;; Predicate
|
||||
(define (mbase? v)
|
||||
|
|
|
@ -363,8 +363,14 @@
|
|||
(values (set-bst-node-value n (proc (bst-node-value n)))
|
||||
0)
|
||||
(if (<? k nk)
|
||||
(loop (bst-node-left n))
|
||||
(loop (bst-node-right n)))))
|
||||
(let-values (((new-left-node add-count)
|
||||
(loop (bst-node-left n))))
|
||||
(values (set-bst-node-left n new-left-node)
|
||||
add-count))
|
||||
(let-values (((new-right-node add-count)
|
||||
(loop (bst-node-right n))))
|
||||
(values (set-bst-node-right n new-right-node)
|
||||
add-count)))))
|
||||
(values (make-bst-node k (proc v)) 1)))))
|
||||
(set-bst-root+count bst
|
||||
new-root
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue