From ec3c74b5e273df362938cdada85949479cd66d5f Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 22 Nov 2020 21:21:31 +0100 Subject: [PATCH] networks: Add forms->boolean-network. --- networks.rkt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/networks.rkt b/networks.rkt index 82be953..9d8e78f 100644 --- a/networks.rkt +++ b/networks.rkt @@ -32,6 +32,7 @@ [update-function-form->update-function (-> update-function-form? update-function/c)] [network-form->network (-> network-form? network?)] [make-boolean-network-form (-> variable-mapping? network-form?)] + [forms->boolean-network (-> variable-mapping? network?)] [list-syntactic-interactions (-> network-form? variable? (listof variable?))] [build-syntactic-interaction-graph (-> network-form? graph?)] [interaction? (-> network? variable? variable? boolean?)] @@ -299,6 +300,18 @@ (make-boolean-network-form (hash 'a '(and a b) 'b '(not b))))) +;;; Build a Boolean network from a given mapping assigning forms +;;; to variables. +(define forms->boolean-network + (compose network-form->network make-boolean-network-form)) + +(module+ test + (test-case "forms->boolean-network" + (define n (forms->boolean-network (hash 'a '(and a b) + 'b '(not b)))) + (check-equal? (network-domains n) (hash 'a '(#f #t) + 'b '(#f #t))))) + ;;; ============================ ;;; Inferring interaction graphs