rs: Make build-interactive-process run for one extra step.
This commit is contained in:
parent
9ce3040240
commit
d958533d2c
2 changed files with 8 additions and 5 deletions
|
@ -81,4 +81,5 @@
|
||||||
(list (set 'y) (set 'y 'z))
|
(list (set 'y) (set 'y 'z))
|
||||||
(list (set 'z) (set))
|
(list (set 'z) (set))
|
||||||
(list (set) (set))
|
(list (set) (set))
|
||||||
(list (set 'z) (set))))))
|
(list (set 'z) (set))
|
||||||
|
(list (set) (set))))))
|
||||||
|
|
10
rs.rkt
10
rs.rkt
|
@ -178,13 +178,15 @@
|
||||||
;;; sequence. The output is a list of pairs of lists in which the
|
;;; sequence. The output is a list of pairs of lists in which the
|
||||||
;;; first element is the current context and the second element is the
|
;;; first element is the current context and the second element is the
|
||||||
;;; result of the application of reactions to the previous state. The
|
;;; result of the application of reactions to the previous state. The
|
||||||
;;; interactive process stops when there are no more contexts left.
|
;;; interactive process stops one step after the end of the context
|
||||||
|
;;; sequence, to show the effect of the last context.
|
||||||
(define (build-interactive-process rs contexts)
|
(define (build-interactive-process rs contexts)
|
||||||
(let ([dyn (dynamics rs)])
|
(let ([dyn (dynamics rs)]
|
||||||
|
[padded-contexts (append contexts (list (set)))])
|
||||||
(for/fold ([proc '()]
|
(for/fold ([proc '()]
|
||||||
[st (state (set) contexts)]
|
[st (state (set) padded-contexts)]
|
||||||
#:result (reverse proc))
|
#:result (reverse proc))
|
||||||
([c contexts])
|
([c padded-contexts])
|
||||||
(values
|
(values
|
||||||
(cons (match st
|
(cons (match st
|
||||||
[(state res ctx)
|
[(state res ctx)
|
||||||
|
|
Loading…
Reference in a new issue