rs: Make build-interactive-process run for one extra step.

This commit is contained in:
Sergiu Ivanov 2020-03-03 01:00:21 +01:00
parent 9ce3040240
commit d958533d2c
2 changed files with 8 additions and 5 deletions

View file

@ -81,4 +81,5 @@
(list (set 'y) (set 'y 'z))
(list (set 'z) (set))
(list (set) (set))
(list (set 'z) (set))))))
(list (set 'z) (set))
(list (set) (set))))))

10
rs.rkt
View file

@ -178,13 +178,15 @@
;;; 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
;;; 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)
(let ([dyn (dynamics rs)])
(let ([dyn (dynamics rs)]
[padded-contexts (append contexts (list (set)))])
(for/fold ([proc '()]
[st (state (set) contexts)]
[st (state (set) padded-contexts)]
#:result (reverse proc))
([c contexts])
([c padded-contexts])
(values
(cons (match st
[(state res ctx)