From b928d6c78ab00fed260bf497ceea35012e863913 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 22 Jun 2014 22:49:13 -0400 Subject: [PATCH] Use actor macro --- minimart/examples/udp-hello.rkt | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/minimart/examples/udp-hello.rkt b/minimart/examples/udp-hello.rkt index 4b6bc3e..da5347e 100644 --- a/minimart/examples/udp-hello.rkt +++ b/minimart/examples/udp-hello.rkt @@ -4,13 +4,8 @@ (spawn-udp-driver) -(spawn (lambda (e s) - (match e - [(message (udp-packet src dst body) _ _) - (log-info "Got packet from ~v: ~v" src body) - (transition s (send (udp-packet dst - src - (string->bytes/utf-8 (format "You said: ~a" body)))))] - [_ #f])) - (void) - (gestalt-union (sub (udp-packet ? (udp-listener 5999) ?)))) +(actor #:name echoer + (subscribe (udp-packet ($ src) ($ dst (udp-listener 5999)) ($ body)) + (log-info "Got packet from ~v: ~v" src body) + (define reply (string->bytes/utf-8 (format "You said: ~a" body))) + (send (udp-packet dst src reply))))