From d958533d2cbc52fd8a46eef990d115aa65ee2b84 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Tue, 3 Mar 2020 01:00:21 +0100 Subject: [PATCH] rs: Make build-interactive-process run for one extra step. --- rs-tests.rkt | 3 ++- rs.rkt | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rs-tests.rkt b/rs-tests.rkt index d25b355..2c0ae5b 100644 --- a/rs-tests.rkt +++ b/rs-tests.rkt @@ -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)))))) diff --git a/rs.rkt b/rs.rkt index 7b6a855..03a8462 100644 --- a/rs.rkt +++ b/rs.rkt @@ -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)