utils: ht-values:list->set -> ht-values/list->set

This commit is contained in:
Sergiu Ivanov 2020-03-02 18:17:05 +01:00
parent 45db731859
commit 29d8e152d9
2 changed files with 3 additions and 3 deletions

View file

@ -118,5 +118,5 @@
(check-equal? e1 '((1 2) (1 3))) (check-equal? l1 '((a) (b)))
(check-equal? e2 '((1 2))) (check-equal? l2 '((b a)))
(check-equal? e3 '(a b)) (check-equal? l3 (list (set 1) (set 2))))
(check-equal? (ht-values:list->set #hash((a . (1 1))))
(check-equal? (ht-values/list->set #hash((a . (1 1))))
(hash 'a (set 1))))

View file

@ -28,7 +28,7 @@
[collect-by-key (-> (listof any/c) (listof any/c) (values (listof any/c) (listof (listof any/c))))]
[collect-by-key/sets (-> (listof any/c) (listof any/c) (values (listof any/c) (listof (set/c any/c))))]
[ht-values:list->set (-> (hash/c any/c (listof any/c)) (hash/c any/c (set/c any/c)))])
[ht-values/list->set (-> (hash/c any/c (listof any/c)) (hash/c any/c (set/c any/c)))])
;; Contracts
(contract-out [variable-mapping? contract?]
[string-variable-mapping? contract?]
@ -287,6 +287,6 @@
(values es (map list->set ls))))
;;; Converts the values of a hash table from lists to sets.
(define (ht-values:list->set ht)
(define (ht-values/list->set ht)
(for/hash ([(k v) (in-hash ht)])
(values k (list->set v))))