Add hash->ordered-list.

This commit is contained in:
Sergiu Ivanov 2021-05-13 21:47:44 +02:00
parent 89612a501c
commit 9c9f9d921d
1 changed files with 6 additions and 0 deletions

View File

@ -168,6 +168,12 @@
;; whether the results make sense. ;; whether the results make sense.
(require typed/rackunit) (require typed/rackunit)
;; TODO: Submit an update to hash->list in Racket and then remove
;; this function.
(: hash->ordered-list (All (a b) (-> (HashTable a b) (Listof (Pairof a b)))))
(define (hash->ordered-list h)
(hash-map h (inst cons a b) #t))
(test-case "1 Generic Graph Interface" (test-case "1 Generic Graph Interface"
(define g (directed-graph '((a b) (b c)))) (define g (directed-graph '((a b) (b c))))
(check-false (has-edge? g 'a 'c)) (check-false (has-edge? g 'a 'c))