bn: new-state -> make-state
This commit is contained in:
parent
5408f6682b
commit
a967dc4b74
2 changed files with 4 additions and 4 deletions
|
@ -19,14 +19,14 @@
|
||||||
[bn (make-bn `((x1 . ,f1) (x2 . ,f2)))])
|
[bn (make-bn `((x1 . ,f1) (x2 . ,f2)))])
|
||||||
|
|
||||||
(test-case "One-step syncronous update"
|
(test-case "One-step syncronous update"
|
||||||
(let* ([s (new-state '((x1 . #t) (x2 . #f)))]
|
(let* ([s (make-state '((x1 . #t) (x2 . #f)))]
|
||||||
[new-s (update bn s '(x2 x1))])
|
[new-s (update bn s '(x2 x1))])
|
||||||
(check-equal? (hash-ref new-s 'x1) #t)
|
(check-equal? (hash-ref new-s 'x1) #t)
|
||||||
(check-equal? (hash-ref new-s 'x2) #t)
|
(check-equal? (hash-ref new-s 'x2) #t)
|
||||||
(check-equal? (length (hash-keys new-s)) 2)))
|
(check-equal? (length (hash-keys new-s)) 2)))
|
||||||
|
|
||||||
(test-case "One-step asynchronous update"
|
(test-case "One-step asynchronous update"
|
||||||
(let* ([s (new-state '((x1 . #f) (x2 . #f)))]
|
(let* ([s (make-state '((x1 . #f) (x2 . #f)))]
|
||||||
[new-s (update bn s '(x2 x1))])
|
[new-s (update bn s '(x2 x1))])
|
||||||
(check-equal? (hash-ref new-s 'x1) #f)
|
(check-equal? (hash-ref new-s 'x1) #f)
|
||||||
(check-equal? (hash-ref new-s 'x2) #t)
|
(check-equal? (hash-ref new-s 'x2) #t)
|
||||||
|
|
4
bn.rkt
4
bn.rkt
|
@ -8,7 +8,7 @@
|
||||||
;;; The variables to be updated at each step are given by the mode.
|
;;; The variables to be updated at each step are given by the mode.
|
||||||
|
|
||||||
(provide Variable State UpdateFunc Network
|
(provide Variable State UpdateFunc Network
|
||||||
update new-state make-bn)
|
update make-state make-bn)
|
||||||
|
|
||||||
(define-type Variable Symbol)
|
(define-type Variable Symbol)
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
new-s))
|
new-s))
|
||||||
|
|
||||||
;;; A version of make-hash restricted to creating Boolean states.
|
;;; A version of make-hash restricted to creating Boolean states.
|
||||||
(define (new-state [mappings : (Listof (Pairof Variable Boolean))])
|
(define (make-state [mappings : (Listof (Pairof Variable Boolean))])
|
||||||
(make-hash mappings))
|
(make-hash mappings))
|
||||||
|
|
||||||
;;; A version of make-hash restricted to creating Boolean networks.
|
;;; A version of make-hash restricted to creating Boolean networks.
|
||||||
|
|
Loading…
Reference in a new issue