diff --git a/utils-tests.rkt b/utils-tests.rkt index 847247b..7fd5ddb 100644 --- a/utils-tests.rkt +++ b/utils-tests.rkt @@ -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)) diff --git a/utils.rkt b/utils.rkt index d6eab79..2ef33f3 100644 --- a/utils.rkt +++ b/utils.rkt @@ -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) ( (integer-in 1 4294967087) (stream/c exact-nonnegative-integer?))