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"