From a3ac1c7fcd94c0458f770c41196e5625efbca6fd Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sat, 21 Nov 2020 22:53:45 +0100 Subject: [PATCH] networks: Include domains into the network. This change is breaking. The following commits will progressively fix the whole network module. --- networks.rkt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/networks.rkt b/networks.rkt index 5f59387..951a4b8 100644 --- a/networks.rkt +++ b/networks.rkt @@ -18,7 +18,9 @@ (contract-out [struct tbf/state ([weights (hash/c variable? number?)] [threshold number?])] [struct dynamics ([network network?] - [mode mode?])]) + [mode mode?])] + [struct network ([functions (hash/c variable? procedure?)] + [domains domain-mapping/c])]) ;; Functions (contract-out [update (-> network? state? (set/c variable? #:kind 'dont-care) state?)] [make-state (-> (listof (cons/c symbol? any/c)) state?)] @@ -173,13 +175,10 @@ ;;; state. (define update-function/c (-> state? any/c)) -;;; A network is a mapping from its variables to its update functions. -;;; -;;; Note that the domains of the variables of the network are not part -;;; of the network definition. This is because the variables of some -;;; networks may have infinite domains, which can be restricted in -;;; multiple different ways. -(define network? (hash/c variable? procedure?)) +;;; A network consists of a mapping from its variables to its update +;;; variables, as a well as of a mapping from its variables to +;;; their domains. +(struct network (functions domains)) ;;; Given a state s updates all the variables from xs. (define (update network s xs)