From c92beaa5bf8912c0cc3b1b43976bfb2cf56abea9 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 3 Apr 2015 21:42:32 -0400 Subject: [PATCH] Fix semantics bug --- .../examples/example-swap-int-and-claim.rkt | 27 +++++++++++++++++++ prospect/mux.rkt | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 prospect/examples/example-swap-int-and-claim.rkt diff --git a/prospect/examples/example-swap-int-and-claim.rkt b/prospect/examples/example-swap-int-and-claim.rkt new file mode 100644 index 0000000..31375ba --- /dev/null +++ b/prospect/examples/example-swap-int-and-claim.rkt @@ -0,0 +1,27 @@ +#lang prospect +;; Analogous to nc-incremental-swap-int-and-claim.rkt in the Redex model. +;; Demonstrates (hopefully) correct processing of feedback at interest switches. + +(require rackunit) + +(spawn (lambda (e u) + (if (< (length u) 3) + (transition + (append u (list e)) + (if (null? u) + (patch-seq (assert 'a) (unsub 'a)) + '())) + (begin0 #f (check-equal? u (list #f #f #f))))) + '() + (sub 'a)) + +(spawn (lambda (e u) + (if (< (length u) 3) + (transition + (append u (list e)) + (if (null? u) + (patch-seq (retract 'b) (sub 'b)) + '())) + (begin0 #f (check-equal? u (list #f #f #f))))) + '() + (assert 'b)) diff --git a/prospect/mux.rkt b/prospect/mux.rkt index dde3668..ceba083 100644 --- a/prospect/mux.rkt +++ b/prospect/mux.rkt @@ -64,7 +64,8 @@ (patch-union (patch (biased-intersection new-routing-table (patch-added delta)) (biased-intersection old-routing-table (patch-removed delta))) - (view-patch delta-aggregate (mux-interests-of m pid)))) + (patch (biased-intersection (patch-added delta-aggregate) new-interests) + (biased-intersection (patch-removed delta-aggregate) old-interests)))) (cons label feedback)] [else (cons pid (view-patch delta-aggregate (mux-interests-of m pid)))]))