From a4979d9c9f8f01472694bdffc402684c8900607b Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 22 Nov 2020 21:18:22 +0100 Subject: [PATCH] networks: Add make-boolean-network-form. --- networks.rkt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/networks.rkt b/networks.rkt index bf8bb74..82be953 100644 --- a/networks.rkt +++ b/networks.rkt @@ -31,6 +31,7 @@ [booleanize-state (-> state? state?)] [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?)] [list-syntactic-interactions (-> network-form? variable? (listof variable?))] [build-syntactic-interaction-graph (-> network-form? graph?)] [interaction? (-> network? variable? variable? boolean?)] @@ -288,6 +289,16 @@ (define s (make-state '((a . #t) (b . #t)))) (check-equal? ((hash-ref (network-functions bn) 'a) s) #t))) +;;; Build a Boolean network form from a given mapping assigning forms +;;; to variables. +(define (make-boolean-network-form forms) + (network-form forms (make-boolean-domains (hash-keys forms)))) + +(module+ test + (test-case "make-boolean-network-form" + (make-boolean-network-form (hash 'a '(and a b) + 'b '(not b))))) + ;;; ============================ ;;; Inferring interaction graphs