Rename bst-dict to bdict.

This commit is contained in:
Dominik Pantůček 2023-07-07 11:05:34 +02:00
parent 2fe483c947
commit 2079fb8ef3
3 changed files with 9 additions and 8 deletions

45
src/util-bst-bdict.scm Normal file
View file

@ -0,0 +1,45 @@
(declare (unit util-bst-bdict))
(import duck)
(module*
util-bst-bdict
#:doc ("...")
(
list->bdict
bdict-find-value
bdict-ref
bdict-filter-values
bdict-keys
bdict-map-list
bdict-map-dict
bdict-update
)
(import scheme
util-bst)
(define (list->bdict lst)
(list->bst lst 'fixnum eq? <))
(define (bdict-find-value d p?)
(let ((kv (bst-find-pair d p?)))
(if kv
(cdr kv)
#f)))
(define bdict-ref bst-ref)
(define (bdict-filter-values d p?)
(map cdr (bst-filter-pairs d p?)))
(define bdict-keys bst-keys)
(define bdict-map-list bst-map-list)
(define bdict-map-dict bst-map-bst)
(define bdict-update bst-update)
)