diff --git a/networks.rkt b/networks.rkt index 447c187..cb909f3 100644 --- a/networks.rkt +++ b/networks.rkt @@ -254,16 +254,21 @@ (check-equal? (f s) #f))) ;;; Build a network from a network form. -(define (network-form->network bnf) - (for/hash ([(x form) bnf]) - (values x (update-function-form->update-function form)))) +(define (network-form->network nf) + (network + (for/hash ([(x form) (in-hash (network-form-forms nf))]) + (values x (update-function-form->update-function form))) + (network-form-domains nf))) (module+ test (test-case "network-form->network" (define bn (network-form->network - (make-hash '((a . (and a b)) (b . (not b)))))) + (network-form (hash 'a '(and a b) + 'b '(not b)) + (hash 'a (#f #t) + 'b (#f #t))))) (define s (make-state '((a . #t) (b . #t)))) - (check-equal? ((hash-ref bn 'a) s) #t))) + (check-equal? ((hash-ref (network-functions bn) 'a) s) #t))) ;;; Build a network from a list of pairs of forms of update functions. (define (make-network-from-forms forms)