bn: Add and use make-bn.
This commit is contained in:
parent
1e931102d6
commit
5408f6682b
2 changed files with 6 additions and 2 deletions
|
@ -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)))]
|
||||
|
|
6
bn.rkt
6
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))
|
||||
|
|
Loading…
Reference in a new issue