From cc121fc9e3808cc1e3d3df862830c08e04510401 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Fri, 16 Sep 2022 17:57:15 +0200 Subject: [PATCH] Type make-syn and make-asyn. --- networks.rkt | 16 +++++++++++++++- scribblings/networks.scrbl | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/networks.rkt b/networks.rkt index 861aaf3..5b292ec 100644 --- a/networks.rkt +++ b/networks.rkt @@ -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) diff --git a/scribblings/networks.scrbl b/scribblings/networks.scrbl index 2ff56b1..ce7e40a 100644 --- a/scribblings/networks.scrbl +++ b/scribblings/networks.scrbl @@ -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))] + +} + }