syndicate-2017/racket/syndicate/examples/example-wildcard-assertion-...

33 lines
1.0 KiB
Racket
Raw Normal View History

#lang syndicate/core
2016-02-03 04:01:08 +00:00
;; Demonstrate almost-wildcard assertions.
;; One actor subscribes to everything except inbound assertions - and so initially sees itself.
;; The other advertises everything except subscriptions and inbound/outbound assertions.
;; The first actor's aggregate view of the dataspace then includes everything
;; except inbound assertions.
2016-02-03 04:01:08 +00:00
2016-04-01 23:53:46 +00:00
(require syndicate/pretty)
2016-02-03 04:01:08 +00:00
(actor (lambda (e s)
2016-02-03 04:01:08 +00:00
(printf "Subscriber - Aggregate\n")
2016-04-01 23:53:46 +00:00
(syndicate-pretty-print s)
2016-02-03 04:01:08 +00:00
(printf "Subscriber - Patch\n")
2016-04-01 23:53:46 +00:00
(syndicate-pretty-print e)
2016-02-03 04:01:08 +00:00
(newline)
(if (patch? e)
(transition (update-interests s e) '())
#f))
trie-empty
(patch-seq (sub ?)
(unsub (inbound ?))))
2016-02-03 04:01:08 +00:00
(actor (lambda (e s)
2016-02-03 04:01:08 +00:00
(printf "Asserter\n")
2016-04-01 23:53:46 +00:00
(syndicate-pretty-print e)
2016-02-03 04:01:08 +00:00
(newline)
#f)
(void)
(patch-seq (assert ?)
(retract (observe ?))
(retract (outbound ?))
(retract (inbound ?))))