From 9c9f9d921d42ab4bb7a91c155a3efa847b7d1196 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 13 May 2021 21:47:44 +0200 Subject: [PATCH] Add hash->ordered-list. --- graph.rkt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/graph.rkt b/graph.rkt index f7ab76e..2cf9d2f 100644 --- a/graph.rkt +++ b/graph.rkt @@ -168,6 +168,12 @@ ;; whether the results make sense. (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" (define g (directed-graph '((a b) (b c)))) (check-false (has-edge? g 'a 'c))