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
|
||||
;;; corresponds to a parallel mode.
|
||||
(define (update [bn : Network] ; the Boolean network
|
||||
[s : State] ; the state to operate on
|
||||
[xs : (Listof Variable)]) ; the variables to update
|
||||
(: update (-> Network State (Listof Variable) State))
|
||||
(define (update bn ; the Boolean network
|
||||
s ; the state to operate on
|
||||
xs) ; the variables to update
|
||||
(let ([new-s : State (hash-copy s)])
|
||||
(for ([x xs])
|
||||
(let ([f (hash-ref bn x)])
|
||||
|
@ -36,9 +37,11 @@
|
|||
new-s))
|
||||
|
||||
;;; 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))
|
||||
|
||||
;;; 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))
|
||||
|
|
Loading…
Reference in a new issue