Implement ldict-empty? predicate.
This commit is contained in:
parent
6d3d7079cf
commit
920fab2b83
2 changed files with 17 additions and 0 deletions
|
@ -31,6 +31,8 @@
|
|||
TAG-LDICT
|
||||
|
||||
make-ldict
|
||||
|
||||
ldict-empty?
|
||||
|
||||
ldict-has-key?
|
||||
ldict-ref
|
||||
|
@ -71,6 +73,15 @@
|
|||
(loop (ldict-set ld (caar pairs) (cdar pairs))
|
||||
(cdr pairs))))))
|
||||
|
||||
;; Convenience accessors
|
||||
(define ldict-meta cadr)
|
||||
(define ldict-equality? caadr)
|
||||
(define ldict-list cddr)
|
||||
|
||||
;; Returns true if given dictionary contains no keys
|
||||
(define (ldict-empty? d)
|
||||
(null? (ldict-list d)))
|
||||
|
||||
;; Checks whether given dictionary d contains the key k.
|
||||
(define (dict-has-key? d k)
|
||||
(if (assq k d) #t #f))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue