26 lines
455 B
Plaintext
26 lines
455 B
Plaintext
fn foo (val) -> receive {
|
|
(:report) -> {
|
|
print! ("LUDUS SAYS ==> value is {val}")
|
|
foo (val)
|
|
}
|
|
(:set, x) -> {
|
|
print! ("LUDUS SAYS ==> foo! was {val}, now is {x}")
|
|
foo (x)
|
|
}
|
|
(:get, pid) -> {
|
|
print! ("LUDUS SAYS ==> value is {val}")
|
|
send (pid, (:response, val))
|
|
foo (val)
|
|
}
|
|
}
|
|
|
|
let fooer = spawn! (fn () -> foo (42))
|
|
print! (fooer)
|
|
send (fooer, (:set, 23))
|
|
yield! ()
|
|
send (fooer, (:get, self ()))
|
|
yield! ()
|
|
|
|
flush! ()
|
|
|