From 768fa7aabc6d9012b448ade8c91b7646f414da89 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 20 Feb 2020 14:13:48 +0100 Subject: [PATCH] networks: Restructure the exports slightly. --- networks.rkt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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?)