Implement set equality.

This commit is contained in:
Dominik Pantůček 2023-04-11 13:49:28 +02:00
parent 30664d10f8
commit 575c1cdb3d
7 changed files with 44 additions and 7 deletions

View file

@ -47,6 +47,8 @@
ldict-map
ldict-filter
ldict-reduce
ldict-equal?
ldict-tests!
)
@ -55,7 +57,8 @@
(chicken base)
testing
util-tag
util-proc)
util-proc
util-set-list)
;; Tag used for identifying list dictionaries from this module
(define TAG-LDICT (make-tag LDICT))
@ -208,6 +211,14 @@
(loop (cdr pairs)
(proc acc (caar pairs) (cdar pairs))))))
;; Returns true if both dictionaries contain the same keys and
;; values.
(define (ldict-equal? d1 d2)
(let ((k1 (list->lset (ldict-keys d1)))
(k2 (list->lset (ldict-keys d2))))
;; Compare key sets
#f))
;; Performs self-tests of the dictionary module.
(define (ldict-tests!)
(run-tests