Type make-syn and make-asyn.

This commit is contained in:
Sergiu Ivanov 2022-09-16 17:57:15 +02:00
parent 60fd8b2a24
commit cc121fc9e3
2 changed files with 33 additions and 1 deletions

View File

@ -33,7 +33,7 @@
build-interaction-graph/form build-signed-interaction-graph
build-signed-interaction-graph/form
Modality Mode dynamics% Dynamics%
Modality Mode dynamics% Dynamics% make-syn make-asyn
)
(define-type (State a) (VariableMapping a))
@ -600,6 +600,20 @@
(test-case "dynamics%:build-state-graph"
(check-equal? (graphviz (send dyn-syn build-state-graph (list s1)))
(graphviz (send dyn-syn build-state-graph* (list s1) 'full))))))
(: make-asyn (-> (Listof Variable) Mode))
(define (make-asyn vars) (map (inst list Variable) vars))
(module+ test
(test-case "make-asyn"
(check-equal? (make-asyn '(x y z)) '((x) (y) (z)))))
(: make-syn (-> (Listof Variable) Mode))
(define (make-syn vars) (list vars))
(module+ test
(test-case "make-syn"
(check-equal? (make-syn '(x y z)) '((x y z)))))
)
(require 'typed)

View File

@ -427,6 +427,24 @@ The type constructor @racket[Dynamics%] takes this limitation into account.
}
@defproc[(make-asyn [vars (Listof Variable)]) Mode]{
Given a list of variables, builds the asynchronous mode, i.e. a set of
singleton sets of variables.
@ex[(make-asyn '(x y z))]
}
@defproc[(make-syn [vars (Listof Variable)]) Mode]{
Given a list of variables, builds the synchronous mode, i.e. a singleton set
containing the set of all variables.
@ex[(make-syn '(x y z))]
}
}