networks: Rewrite update.
This commit is contained in:
parent
6560dcbe6c
commit
11d75bcc89
1 changed files with 3 additions and 4 deletions
|
@ -181,10 +181,9 @@
|
||||||
|
|
||||||
;;; Given a state s updates all the variables from xs.
|
;;; Given a state s updates all the variables from xs.
|
||||||
(define (update network s xs)
|
(define (update network s xs)
|
||||||
(for/fold ([new-s s])
|
(define funcs (network-functions network))
|
||||||
([x xs])
|
(for/hash ([x xs])
|
||||||
(let ([f (hash-ref network x)])
|
(x ((hash-ref funcs x) s))))
|
||||||
(hash-set new-s x (f s)))))
|
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(test-case "basic definitions"
|
(test-case "basic definitions"
|
||||||
|
|
Loading…
Reference in a new issue