filter-event

This commit is contained in:
Tony Garnock-Jones 2014-06-27 16:25:26 -04:00
parent 8050324f5b
commit 20a50967c5
1 changed files with 9 additions and 0 deletions

View File

@ -35,6 +35,7 @@
sub
pub
gestalt-accepts?
filter-event
send
feedback
@ -131,6 +132,14 @@
(match-define (message b ml f?) m)
(not (set-empty? (gestalt-match-value g b ml f?))))
;; (Option Event) Gestalt -> (Option Event)
;; Returns a filtered version of e, narrowed to the perspective of g-filter.
(define (filter-event e g-filter)
(match e
[#f #f]
[(routing-update g) (routing-update (gestalt-filter g g-filter))]
[(? message? m) (and (gestalt-accepts? g-filter m) m)]))
;; Behavior Any [Gestalt] -> Action
;; Constructs a spawn Action for a new process with the given behavior
;; and state. If a Gestalt is supplied, the new process will begin its