Start implementing symbol ldict.

This commit is contained in:
Dominik Pantůček 2023-07-07 11:22:47 +02:00
parent 0bcc49f99e
commit 33fadab5e7
3 changed files with 66 additions and 0 deletions

View file

@ -35,6 +35,8 @@
bst-update
bst-filter
util-bst-tests!
)
@ -375,6 +377,14 @@
new-root
(+ (bst-count bst) add-count)))))
(define/doc (bst-filter bst pred?)
("Returns a BST with only KV pairs matching the predicate which must
accept two arguments.")
(kvv->bst
(cons TAG-KVV
(cons (apply vector (bst-filter-pairs bst pred?))
(cddr bst)))))
;; Module self-tests
(define (util-bst-tests!)
(run-tests