network: Roll back update to its previous version.
I thought I was clever to rewrite update using for/hash, but in fact this new version only included the updated variables in the new state :D
This commit is contained in:
parent
3abf548ac2
commit
354fad2b1d
1 changed files with 4 additions and 2 deletions
|
@ -203,8 +203,10 @@
|
|||
;;; Given a state s updates all the variables from xs.
|
||||
(define (update network s xs)
|
||||
(define funcs (network-functions network))
|
||||
(for/hash ([x xs])
|
||||
(values x ((hash-ref funcs x) s))))
|
||||
(for/fold ([new-s s])
|
||||
([x xs])
|
||||
(define fx (hash-ref funcs x))
|
||||
(hash-set new-s x (fx s))))
|
||||
|
||||
(module+ test
|
||||
(test-case "basic definitions"
|
||||
|
|
Loading…
Reference in a new issue