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.
This commit is contained in:
Sergiu Ivanov 2020-11-12 00:58:58 +01:00
parent cde6ee30fa
commit f414ae8966

View file

@ -14,10 +14,12 @@
graph racket/random racket/hash) graph racket/random racket/hash)
(provide (provide
;; Structures
(struct-out dynamics) (struct-out dynamics)
;; Structures
(contract-out [struct tbf/state ([weights (hash/c variable? number?)] (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 ;; Functions
(contract-out [update (-> network? state? (set/c variable? #:kind 'dont-care) state?)] (contract-out [update (-> network? state? (set/c variable? #:kind 'dont-care) state?)]
[make-state (-> (listof (cons/c symbol? any/c)) state?)] [make-state (-> (listof (cons/c symbol? any/c)) state?)]
@ -166,8 +168,9 @@
;;; state. ;;; state.
(define update-function/c (-> state? any/c)) (define update-function/c (-> state? any/c))
;;; A network is a mapping from its variables to its update functions. ;;; A network is a mapping from its variables to its update functions,
(define network? (hash/c variable? procedure?)) ;;; together with the domains of the variables.
(struct network (functions domains))
;;; Given a state s updates all the variables from xs. This ;;; Given a state s updates all the variables from xs. This
;;; corresponds to a parallel mode. ;;; corresponds to a parallel mode.