generic: Use collect-by-key/sets to collect the labels for state graphs.

This commit is contained in:
Sergiu Ivanov 2020-03-02 18:18:23 +01:00
parent 29d8e152d9
commit 141080d1c6
2 changed files with 9 additions and 9 deletions

View File

@ -41,7 +41,7 @@
[labels empty] [labels empty]
[current-states states] [current-states states]
[visited-states states] [visited-states states]
#:result (collect-by-key edges labels)) #:result (collect-by-key/sets edges labels))
([i step-range] ([i step-range]
#:break (set-empty? current-states)) #:break (set-empty? current-states))
(for/fold ([new-edges empty] (for/fold ([new-edges empty]

View File

@ -186,25 +186,25 @@
(#hash((a . #f) (b . #t)) #hash((a . #t) (b . #t))))) (#hash((a . #f) (b . #t)) #hash((a . #t) (b . #t)))))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #f) (b . #f)) #hash((a . #t) (b . #f))) #hash((a . #f) (b . #f)) #hash((a . #t) (b . #f)))
(list (set 'a))) (set (set 'a)))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #f) (b . #f)) #hash((a . #f) (b . #f))) #hash((a . #f) (b . #f)) #hash((a . #f) (b . #f)))
(list (set 'b))) (set (set 'b)))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #t) (b . #f)) #hash((a . #t) (b . #f))) #hash((a . #t) (b . #f)) #hash((a . #t) (b . #f)))
(list (set 'b))) (set (set 'b)))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #t) (b . #f)) #hash((a . #f) (b . #f))) #hash((a . #t) (b . #f)) #hash((a . #f) (b . #f)))
(list (set 'a))) (set (set 'a)))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #t) (b . #t)) #hash((a . #f) (b . #t))) #hash((a . #t) (b . #t)) #hash((a . #f) (b . #t)))
(list (set 'a))) (set (set 'a)))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #t) (b . #t)) #hash((a . #t) (b . #t))) #hash((a . #t) (b . #t)) #hash((a . #t) (b . #t)))
(list (set 'b))) (set (set 'b)))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #f) (b . #t)) #hash((a . #f) (b . #t))) #hash((a . #f) (b . #t)) #hash((a . #f) (b . #t)))
(list (set 'b))) (set (set 'b)))
(check-equal? (edge-weight gr-complete-bool-ann (check-equal? (edge-weight gr-complete-bool-ann
#hash((a . #f) (b . #t)) #hash((a . #t) (b . #t))) #hash((a . #f) (b . #t)) #hash((a . #t) (b . #t)))
(list (set 'a))))) (set (set 'a)))))