Switch from co-role -> co-roles
This commit is contained in:
parent
ffe06a65a8
commit
ea2ff20dc6
|
@ -24,7 +24,7 @@
|
||||||
(struct-out topic)
|
(struct-out topic)
|
||||||
topic-publisher
|
topic-publisher
|
||||||
topic-subscriber
|
topic-subscriber
|
||||||
co-role
|
co-roles
|
||||||
co-topic
|
co-topic
|
||||||
|
|
||||||
;; Reexported from unify.rkt for convenience
|
;; Reexported from unify.rkt for convenience
|
||||||
|
@ -245,20 +245,20 @@
|
||||||
(and es ;; some threads are not standard-threads
|
(and es ;; some threads are not standard-threads
|
||||||
(exit-status-exception es)))
|
(exit-status-exception es)))
|
||||||
|
|
||||||
(define (co-role r)
|
(define (co-roles r)
|
||||||
(case r
|
(case r
|
||||||
[(publisher) 'subscriber]
|
[(publisher) '(subscriber)]
|
||||||
[(subscriber) 'publisher]
|
[(subscriber) '(publisher)]
|
||||||
[else #f]))
|
[else #f]))
|
||||||
|
|
||||||
(define (co-topic t)
|
(define (co-topic t new-role)
|
||||||
(struct-copy topic t [role (co-role (topic-role t))]))
|
(struct-copy topic t [role new-role]))
|
||||||
|
|
||||||
(define (refine-topic remote-topic new-pattern)
|
(define (refine-topic remote-topic new-pattern)
|
||||||
(struct-copy topic remote-topic [pattern new-pattern]))
|
(struct-copy topic remote-topic [pattern new-pattern]))
|
||||||
|
|
||||||
(define (roles-intersect? l r)
|
(define (roles-intersect? l r)
|
||||||
(eq? l (co-role r)))
|
(memq l (co-roles r)))
|
||||||
|
|
||||||
;; Both left and right must be canonicalized.
|
;; Both left and right must be canonicalized.
|
||||||
(define (topic-intersection left right)
|
(define (topic-intersection left right)
|
||||||
|
|
|
@ -57,7 +57,9 @@
|
||||||
[(says (and specific-topic (topic 'publisher _ _)) _)
|
[(says (and specific-topic (topic 'publisher _ _)) _)
|
||||||
(write `(,name acking) o)
|
(write `(,name acking) o)
|
||||||
(newline o)
|
(newline o)
|
||||||
(send handle say (co-topic specific-topic) (list name 'ack))]
|
(send handle say
|
||||||
|
(co-topic specific-topic 'subscriber)
|
||||||
|
(list name 'ack))]
|
||||||
[_ (void)])
|
[_ (void)])
|
||||||
(flush-output o)
|
(flush-output o)
|
||||||
(loop)))
|
(loop)))
|
||||||
|
|
Loading…
Reference in New Issue