utils: Add hash->list/ordered.

This commit is contained in:
Sergiu Ivanov 2020-03-21 19:16:24 +01:00
parent a55b671248
commit 8505d2d590
2 changed files with 4 additions and 1 deletions

View file

@ -124,7 +124,9 @@
(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))))
(hash 'a (set 1))))
(hash 'a (set 1)))
(check-equal? (hash->list/ordered #hash((b . 1) (a . 1)))
'((a . 1) (b . 1))))
(test-case "Functions"
(check-true (procedure-fixed-arity? not))

View file

@ -33,6 +33,7 @@
[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)))]
[hash->list/ordered (-> hash? (listof (cons/c any/c any/c)))]
[procedure-fixed-arity? (-> procedure? boolean?)]
[in-random (case-> (-> (stream/c (and/c real? inexact? (>/c 0) (</c 1))))
(-> (integer-in 1 4294967087) (stream/c exact-nonnegative-integer?))