diff --git a/bn.rkt b/bn.rkt index df807cc..5e523e3 100644 --- a/bn.rkt +++ b/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))