From f414ae8966b090af0814f0b94a1938c30df4d3a7 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 12 Nov 2020 00:58:58 +0100 Subject: [PATCH] BREAKING: Make domains part of the network. I always keep bringing domains about for my network, which complicates things a lot. This commit packages the domains within the network, which will break a lot of stuff :-) The following commits will fix it all. --- networks.rkt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/networks.rkt b/networks.rkt index 93db941..32f8a30 100644 --- a/networks.rkt +++ b/networks.rkt @@ -14,10 +14,12 @@ graph racket/random racket/hash) (provide - ;; Structures (struct-out dynamics) + ;; Structures (contract-out [struct tbf/state ([weights (hash/c variable? number?)] - [threshold number?])]) + [threshold number?])] + [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?)] @@ -166,8 +168,9 @@ ;;; state. (define update-function/c (-> state? any/c)) -;;; A network is a mapping from its variables to its update functions. -(define network? (hash/c variable? procedure?)) +;;; A network is a mapping from its variables to its update functions, +;;; together with the domains of the variables. +(struct network (functions domains)) ;;; Given a state s updates all the variables from xs. This ;;; corresponds to a parallel mode.