Implement step*.

This commit is contained in:
Sergiu Ivanov 2022-09-10 17:46:26 +02:00
parent 983380b063
commit 45410176b7
2 changed files with 14 additions and 2 deletions

View File

@ -17,7 +17,11 @@
(define/abstract/error (step/annotated st))
(: step* (-> (Listof State) (Listof State)))
(define/abstract/error (step* sts))
(define/public (step* sts)
(remove-duplicates
(apply append
(for/list : (Listof (Listof State)) ([s sts])
(step s)))))
(: build-state-graph (-> (Listof State) Graph))
(define/abstract/error (build-state-graph sts))

View File

@ -537,7 +537,8 @@
[asyn : Mode '((x) (y) (z))]
[dyn-syn (new (inst dynamics% Boolean) [network n1] [mode syn])]
[dyn-asyn (new (inst dynamics% Boolean) [network n1] [mode asyn])]
[s1 (hash 'x #f 'y #f 'z #f)])
[s1 (hash 'x #f 'y #f 'z #f)]
[s2 (hash 'x #t 'y #t 'z #t)])
(test-case "dynamics%"
(check-equal? (send dyn-syn step/annotated s1)
'(((x y z) . #hash((x . #t) (y . #f) (z . #f)))))
@ -553,6 +554,13 @@
'(#hash((x . #t) (y . #f) (z . #f))
#hash((x . #f) (y . #f) (z . #f))
#hash((x . #f) (y . #f) (z . #f)))))
(test-case "dynamics%:step*"
(check-equal? (list->set (send dyn-syn step* (list s1 s2)))
(list->set (append (send dyn-syn step s1)
(send dyn-syn step s2))))
(check-equal? (list->set (send dyn-asyn step* (list s1 s2)))
(list->set (append (send dyn-asyn step s1)
(send dyn-asyn step s2)))))
)
)
)