Implement and document predicates for ldict and lset.
This commit is contained in:
parent
0d649c2fd0
commit
c0cfa0721f
3 changed files with 26 additions and 0 deletions
12
doc/utils.md
12
doc/utils.md
|
@ -49,6 +49,12 @@ populating it with initial data.
|
|||
If only one argument is given, the procedure checks whether it is a
|
||||
list of equality procedure and acts accordingly.
|
||||
|
||||
(ldict? v)
|
||||
|
||||
* ```v``` - any value
|
||||
|
||||
Returns ```#t``` if given value is a ldict.
|
||||
|
||||
(ldict-empty? ld)
|
||||
|
||||
* ```ld``` - a ldict instance
|
||||
|
@ -213,6 +219,12 @@ This module implements linear-time set with custom comparator.
|
|||
|
||||
Creates new lset with given comparator.
|
||||
|
||||
(lset? v)
|
||||
|
||||
* ```v``` - any value
|
||||
|
||||
Returns ```#t``` if given value is a lset.
|
||||
|
||||
(lset-empty? ls)
|
||||
|
||||
* ```ls``` - lset instance
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
make-ldict
|
||||
|
||||
ldict?
|
||||
|
||||
ldict-empty?
|
||||
|
||||
ldict-contains?
|
||||
|
@ -76,6 +78,11 @@
|
|||
(loop (ldict-set ld (caar pairs) (cdar pairs))
|
||||
(cdr pairs))))))
|
||||
|
||||
;; Returns true if given value is a ldict
|
||||
(define (ldict? v)
|
||||
(and (pair? v)
|
||||
(eq? (car v) TAG-LDICT)))
|
||||
|
||||
;; Convenience accessors
|
||||
(define ldict-meta cadr)
|
||||
(define ldict-equality? caadr)
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
make-lset
|
||||
|
||||
lset?
|
||||
|
||||
lset-empty?
|
||||
|
||||
lset-member?
|
||||
|
@ -67,6 +69,11 @@
|
|||
(list TAG-LSET
|
||||
(list equality?))))
|
||||
|
||||
;; Returns true if given value is lset
|
||||
(define (lset? v)
|
||||
(and (pair? v)
|
||||
(eq? (car v) TAG-LSET)))
|
||||
|
||||
;; Convenience accessors
|
||||
(define lset-meta cadr)
|
||||
(define lset-equality? caadr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue