From 11d75bcc8934d206e7cdc77975638f9ffcc59881 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sat, 21 Nov 2020 23:28:30 +0100 Subject: [PATCH] networks: Rewrite update. --- networks.rkt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/networks.rkt b/networks.rkt index 0dda5cb..7f8850f 100644 --- a/networks.rkt +++ b/networks.rkt @@ -181,10 +181,9 @@ ;;; Given a state s updates all the variables from xs. (define (update network s xs) - (for/fold ([new-s s]) - ([x xs]) - (let ([f (hash-ref network x)]) - (hash-set new-s x (f s))))) + (define funcs (network-functions network)) + (for/hash ([x xs]) + (x ((hash-ref funcs x) s)))) (module+ test (test-case "basic definitions"