anglais/examples/warp.ang
Neemek ca0031431d
All checks were successful
/ test (push) Successful in 47s
more examples
2026-07-15 21:50:23 +02:00

25 lines
322 B
Text

# Aliases
type Receiver = fn() -> any
type Sender = fn(any)
fn new_channel() -> (Sender, Receiver) {
queue := []
fn send(n: any) {
queue.push(n) # mutate in-place
}
fn recv() -> any | nil {
queue.pop()
}
(send, recv)
}
(send, recv) := new_channel()
(
send:,
recv:,
)