diff --git a/prospect/examples/example-wildcard-assertion-1.rkt b/prospect/examples/example-wildcard-assertion-1.rkt new file mode 100644 index 0000000..94e3a5f --- /dev/null +++ b/prospect/examples/example-wildcard-assertion-1.rkt @@ -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 ?)))) diff --git a/prospect/examples/example-wildcard-assertion-2.rkt b/prospect/examples/example-wildcard-assertion-2.rkt new file mode 100644 index 0000000..49ea2f5 --- /dev/null +++ b/prospect/examples/example-wildcard-assertion-2.rkt @@ -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 ?))))