Dataflow Network Programming with Neuron
Eric Griffis RacketCon 2018
- St. Louis, MO
1
Dataflow Network Programming with Neuron Eric Griffis RacketCon - - PowerPoint PPT Presentation
Dataflow Network Programming with Neuron Eric Griffis RacketCon 2018 St. Louis, MO 1 I. Meet Nick 2 Nick cares about cancer 3 Curing cancer is expensive 4 5 6 II. Enter Neuron 7 The Neuron Framework concurrency model messaging API
1
2
3
4
5
6
7
8
9
10-11
12
13-14
15
16
17
18
19
20
21
22-23
(forever (define-values (key msg) (recv πsvc)) (match msg [`(SET ,host ,port) (set-client key host port)] [`(DROP ,host ,port) (drop-client key)] [`(MOVE ,Δx ,Δy) (move-client key Δx Δy)]))
24-25
26
27-28
(define-values (world clients) (values (make-hash) (make-hash))) (define πsvc (tcp-service sexp-codec 3000)) (define (set-client key host port) ... (hash-set! clients key (udp-sink writeln host port))) (define (update-world Δt) ... (define the-world (hash->list world)) (for ([πpub (hash-values clients)]) (give πpub the-world))) (define πsim (simulator update-world)) (forever (define-values (key msg) (recv πsvc)) (match msg [`(SET ,host ,port) (set-client key host port)] [`(DROP ,host ,port) (drop-client key)] [`(MOVE ,Δx ,Δy) (move-client key Δx Δy)]))
29
30
31
32-33
34