diff --git a/networks.rkt b/networks.rkt index eedc28c..60ca706 100644 --- a/networks.rkt +++ b/networks.rkt @@ -13,18 +13,21 @@ (require "utils.rkt") (provide - ;; Functions with contracts + ;; Functions (contract-out [update (-> network? state? (listof variable?) state?)] [make-state (-> (listof (cons/c symbol? any/c)) state?)] - [make-network-from-functions (-> (listof (cons/c symbol? update-function?)) network?)] - [update-function-form->update-function (-> update-function-form? update-function?)] + [make-network-from-functions (-> (listof (cons/c symbol? update-function/c)) network?)] + [update-function-form->update-function (-> update-function-form? update-function/c)] [network-form->network (-> network-form? network?)] [make-network-from-forms (-> (listof (cons/c symbol? update-function-form?)) network?)]) - ;; Functions - variable? state? update-function? update-function-form? network-form? + ;; Predicates + (contract-out [variable? (-> any/c boolean?)] + [state? (-> any/c boolean?)] + [update-function-form? (-> any/c boolean?)] + [network-form? (-> any/c boolean?)]) ;; Contracts - state/c network/c + state/c network/c update-function/c ;; Syntax st nn) @@ -42,7 +45,7 @@ ;;; An update function is a function computing a value from the given ;;; state. -(define update-function? (-> state? any/c)) +(define update-function/c (-> state? any/c)) ;;; A network is a mapping from its variables to its update functions. (define network? variable-mapping?)