diff --git a/networks.rkt b/networks.rkt index e4d4f32..56b1dfb 100644 --- a/networks.rkt +++ b/networks.rkt @@ -962,6 +962,9 @@ ;;; ;;; This function relies on table->function, so the same caveats ;;; apply. +;;; +;;; This function sets the domain mappings of the network to the empty +;;; hash table. (define (table->network table #:headers [headers #t]) (define n (/ (length (car table)) 2)) ;; Get the variable names from the table or generate them, if @@ -984,7 +987,7 @@ (table->function (for/list ([in st-ins] [o out]) (list in o))))) ;; Construct the network. - (make-network-from-functions (map cons var-names funcs))) + (network (map cons var-names funcs) (hash))) (module+ test (test-case "table->network" @@ -993,8 +996,8 @@ (#f #t #f #t) (#t #f #t #f) (#t #t #t #t)))) - (define f1 (hash-ref n 'x1)) - (define f2 (hash-ref n 'x2)) + (define f1 (hash-ref (network-functions n) 'x1)) + (define f2 (hash-ref (network-functions n) 'x2)) (check-false (f1 (make-state '((x1 . #f) (x2 . #f))))) (check-false (f1 (make-state '((x1 . #f) (x2 . #t)))))