bn: Add explicit type annotations to functions.
This commit is contained in:
parent
a385f2e464
commit
d73644c1d7
1 changed files with 8 additions and 5 deletions
13
bn.rkt
13
bn.rkt
|
@ -26,9 +26,10 @@
|
||||||
|
|
||||||
;;; Given a state s updates all the variables from xs. This
|
;;; Given a state s updates all the variables from xs. This
|
||||||
;;; corresponds to a parallel mode.
|
;;; corresponds to a parallel mode.
|
||||||
(define (update [bn : Network] ; the Boolean network
|
(: update (-> Network State (Listof Variable) State))
|
||||||
[s : State] ; the state to operate on
|
(define (update bn ; the Boolean network
|
||||||
[xs : (Listof Variable)]) ; the variables to update
|
s ; the state to operate on
|
||||||
|
xs) ; the variables to update
|
||||||
(let ([new-s : State (hash-copy s)])
|
(let ([new-s : State (hash-copy s)])
|
||||||
(for ([x xs])
|
(for ([x xs])
|
||||||
(let ([f (hash-ref bn x)])
|
(let ([f (hash-ref bn x)])
|
||||||
|
@ -36,9 +37,11 @@
|
||||||
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 (make-state [mappings : (Listof (Pairof Variable Boolean))])
|
(: make-state (-> (Listof (Pairof Variable Boolean)) State))
|
||||||
|
(define (make-state mappings)
|
||||||
(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.
|
||||||
(define (make-bn [funcs : (Listof (Pairof Variable UpdateFunc))])
|
(: make-bn (-> (Listof (Pairof Variable UpdateFunc)) Network))
|
||||||
|
(define (make-bn funcs)
|
||||||
(make-hash funcs))
|
(make-hash funcs))
|
||||||
|
|
Loading…
Reference in a new issue