From 5419278462d1768eaa1c96199b1022842bd947e1 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sat, 28 Nov 2020 23:05:56 +0100 Subject: [PATCH] networks,tbn->network: Use make-01-network. Also add some tests. --- networks.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/networks.rkt b/networks.rkt index c237830..f8ea75b 100644 --- a/networks.rkt +++ b/networks.rkt @@ -1438,8 +1438,8 @@ ;;; Constructs a network from a network form defining a TBN. (define (tbn->network tbn) - (make-boolean-network (for/hash ([(var tbf) (in-hash tbn)]) - (values var ((curry apply-tbf/state) tbf))))) + (make-01-network (for/hash ([(var tbf) (in-hash tbn)]) + (values var ((curry apply-tbf/state) tbf))))) (module+ test (test-case "tbn->network" @@ -1449,13 +1449,15 @@ (define s1 (make-state '((a . 0) (b . 0)))) (check-equal? (update n s1 '(a b)) (make-state '((a . 0) (b . 1)))) + (check-equal? (network-domains n) #hash((a . (0 1)) (b . (0 1)))) (define sbn (make-sbn `((a . ,(make-sbf/state '((b . -1)))) (b . ,(make-sbf/state '((a . 1))))))) (define sn (tbn->network sbn)) (define s2 (make-state '((a . 1) (b . 1)))) (check-equal? (update sn s2 '(a b)) - (make-state '((a . 0) (b . 1)))))) + (make-state '((a . 0) (b . 1)))) + (check-equal? (network-domains sn) #hash((a . (0 1)) (b . (0 1)))))) ;;; A helper function for read-org-tbn and read-org-sbn. It reads a ;;; TBN from an Org-mode sexp containing a list of lists of numbers.