Rename hash-range and domain to keys and values
This commit is contained in:
parent
1ebdb6a90b
commit
f23daa3aea
|
@ -1,8 +1,8 @@
|
|||
(module hash "pre-base.rkt"
|
||||
(define (hash-domain table)
|
||||
(define (hash-keys table)
|
||||
(hash-map table (λ (k v) k)))
|
||||
|
||||
(define (hash-range table)
|
||||
(define (hash-values table)
|
||||
(hash-map table (λ (k v) v)))
|
||||
|
||||
(define (hash->list table)
|
||||
|
@ -26,8 +26,8 @@
|
|||
(hash-set! table (car pairs) (cadr pairs))
|
||||
(loop (cddr pairs)))))
|
||||
|
||||
(provide hash-domain
|
||||
hash-range
|
||||
(provide hash-keys
|
||||
hash-values
|
||||
hash->list
|
||||
hash-set*
|
||||
hash-set*!))
|
|
@ -330,19 +330,19 @@ new value.
|
|||
|
||||
@see-also-concurrency-caveat[]}
|
||||
|
||||
@defproc[(hash-domain [hash hash?])
|
||||
@defproc[(hash-keys [hash hash?])
|
||||
(listof any/c)]{
|
||||
Returns a list of the keys of @scheme[hash] in an unspecified order.
|
||||
|
||||
See @scheme[hash-map] for information about modifying @scheme[hash]
|
||||
during @scheme[hash-domain]. @see-also-concurrency-caveat[]}
|
||||
during @scheme[hash-keys]. @see-also-concurrency-caveat[]}
|
||||
|
||||
@defproc[(hash-range [hash hash?])
|
||||
@defproc[(hash-values [hash hash?])
|
||||
(listof any/c)]{
|
||||
Returns a list of the values of @scheme[hash] in an unspecified order.
|
||||
|
||||
See @scheme[hash-map] for information about modifying @scheme[hash]
|
||||
during @scheme[hash-range]. @see-also-concurrency-caveat[]}
|
||||
during @scheme[hash-values]. @see-also-concurrency-caveat[]}
|
||||
|
||||
@defproc[(hash->list [hash hash?])
|
||||
(listof (cons/c any/c any/c))]{
|
||||
|
|
|
@ -2363,8 +2363,8 @@
|
|||
(check-all-bad hash-iterate-key)
|
||||
(check-all-bad hash-iterate-value))
|
||||
|
||||
(test (list 1 2 3) hash-domain #hasheq((1 . a)(2 . b)(3 . c)))
|
||||
(test (list 'a 'b 'c) hash-range #hasheq((1 . a)(2 . b)(3 . c)))
|
||||
(test (list 1 2 3) hash-keys #hasheq((1 . a)(2 . b)(3 . c)))
|
||||
(test (list 'a 'b 'c) hash-values #hasheq((1 . a)(2 . b)(3 . c)))
|
||||
(test (list (cons 1 'a) (cons 2 'b) (cons 3 'c)) hash->list #hasheq((1 . a)(2 . b)(3 . c)))
|
||||
|
||||
(err/rt-test (hash-set*! im-t 1 2) exn:fail?)
|
||||
|
@ -2399,8 +2399,8 @@
|
|||
|
||||
(arity-test make-immutable-hash 1 1)
|
||||
(arity-test make-immutable-hasheq 1 1)
|
||||
(arity-test hash-domain 1 1)
|
||||
(arity-test hash-range 1 1)
|
||||
(arity-test hash-keys 1 1)
|
||||
(arity-test hash-values 1 1)
|
||||
(arity-test hash-count 1 1)
|
||||
(arity-test hash-ref 2 3)
|
||||
(arity-test hash-set! 3 3)
|
||||
|
|
Loading…
Reference in New Issue
Block a user