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)