diff --git a/bn-tests.rkt b/bn-tests.rkt index e7b81a2..b839e87 100644 --- a/bn-tests.rkt +++ b/bn-tests.rkt @@ -16,7 +16,7 @@ [f2 (λ ([s : State]) (let ([x2 (hash-ref s 'x2)]) (not x2)))] - [bn (hash 'x1 f1 'x2 f2)]) + [bn (make-bn `((x1 . ,f1) (x2 . ,f2)))]) (test-case "One-step syncronous update" (let* ([s (new-state '((x1 . #t) (x2 . #f)))] diff --git a/bn.rkt b/bn.rkt index e56d39a..2112596 100644 --- a/bn.rkt +++ b/bn.rkt @@ -8,7 +8,7 @@ ;;; The variables to be updated at each step are given by the mode. (provide Variable State UpdateFunc Network - update new-state) + update new-state make-bn) (define-type Variable Symbol) @@ -38,3 +38,7 @@ ;;; A version of make-hash restricted to creating Boolean states. (define (new-state [mappings : (Listof (Pairof Variable Boolean))]) (make-hash mappings)) + +;;; A version of make-hash restricted to creating Boolean networks. +(define (make-bn [funcs : (Listof (Pairof Variable UpdateFunc))]) + (make-hash funcs))