bn: Add syntax bn.
This commit is contained in:
parent
6ef7483bd2
commit
74b57c81d7
2 changed files with 9 additions and 2 deletions
|
@ -38,6 +38,9 @@
|
||||||
(let ([bn1 (bn-form->bn (make-hash '((a . (and a b)) (b . (not b)))))]
|
(let ([bn1 (bn-form->bn (make-hash '((a . (and a b)) (b . (not b)))))]
|
||||||
[bn2 (make-bn-forms '((a . (and a b))
|
[bn2 (make-bn-forms '((a . (and a b))
|
||||||
(b . (not b))))]
|
(b . (not b))))]
|
||||||
|
[bn3 (bn '((a . (and a b))
|
||||||
|
(b . (not b))))]
|
||||||
[s (make-state '((a . #t) (b . #t)))])
|
[s (make-state '((a . #t) (b . #t)))])
|
||||||
(check-equal? ((hash-ref bn1 'a) s) #t)
|
(check-equal? ((hash-ref bn1 'a) s) #t)
|
||||||
(check-equal? ((hash-ref bn2 'a) s) #t)))
|
(check-equal? ((hash-ref bn2 'a) s) #t)
|
||||||
|
(check-equal? ((hash-ref bn3 'a) s) #t)))
|
||||||
|
|
6
bn.rkt
6
bn.rkt
|
@ -11,7 +11,8 @@
|
||||||
|
|
||||||
(provide Variable State UpdateFunc Network
|
(provide Variable State UpdateFunc Network
|
||||||
update make-state make-bn-funcs update-func-form->update-func
|
update make-state make-bn-funcs update-func-form->update-func
|
||||||
bn-form->bn make-bn-forms)
|
bn-form->bn make-bn-forms
|
||||||
|
bn)
|
||||||
|
|
||||||
|
|
||||||
;;; =================
|
;;; =================
|
||||||
|
@ -85,3 +86,6 @@
|
||||||
(: make-bn-forms (-> (Listof (Pairof Variable UpdateFuncForm)) Network))
|
(: make-bn-forms (-> (Listof (Pairof Variable UpdateFuncForm)) Network))
|
||||||
(define (make-bn-forms forms)
|
(define (make-bn-forms forms)
|
||||||
(bn-form->bn (make-hash forms)))
|
(bn-form->bn (make-hash forms)))
|
||||||
|
|
||||||
|
;;; A shortcut for make-bn-forms.
|
||||||
|
(define-syntax-rule (bn forms) (make-bn-forms forms))
|
||||||
|
|
Loading…
Reference in a new issue