Demos of wildcard assertions

This commit is contained in:
Tony Garnock-Jones 2016-02-02 23:01:08 -05:00
parent 2884806378
commit b85409ef10
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#lang prospect
;; Demonstrate wildcard assertions.
;; One actor asserts everything except at-meta assertions (which break
;; the ground VM). It therefore *subscribes* to everything too.
(require prospect/pretty)
(spawn (lambda (e s)
(printf "Subscriber - Aggregate\n")
(prospect-pretty-print s)
(printf "Subscriber - Patch\n")
(prospect-pretty-print e)
(newline)
(if (patch? e)
(transition (update-interests s e) '())
#f))
(trie-empty)
(patch-seq (assert ?)
(retract (at-meta ?))))

View File

@ -0,0 +1,30 @@
#lang prospect
;; Demonstrate almost-wildcard assertions.
;; One actor subscribes to everything - and so initially sees itself.
;; The other advertises everything except subscriptions and at-meta assertions.
;; The first actor's aggregate view of the network then includes everything
;; except at-meta assertions.
(require prospect/pretty)
(spawn (lambda (e s)
(printf "Subscriber - Aggregate\n")
(prospect-pretty-print s)
(printf "Subscriber - Patch\n")
(prospect-pretty-print e)
(newline)
(if (patch? e)
(transition (update-interests s e) '())
#f))
(trie-empty)
(sub ?))
(spawn (lambda (e s)
(printf "Asserter\n")
(prospect-pretty-print e)
(newline)
#f)
(void)
(patch-seq (assert ?)
(retract (observe ?))
(retract (at-meta ?))))