✓
Passing This code compiles and runs correctly.
Code
// `__pump_<name>_retired_<i>` — the per-participant retirement unit a
// capture-aware participant emits — fires exactly once, on the first pass
// whose `live` answers 0, ahead of `| drained`. `a` burns out after two
// steps while `b` keeps the pump alive past the crossing: a refire per idle
// pass would print the line three times — the one-shot flag is the pin.
import std/io
import std/pump
import lib/flicker
lib/flicker:light(a: 2, b: 4)
std/pump:create(main)
| drained |> std/io:print.ln("all retired")
// Hand-declared here; a capture transform emits this pair itself — the unit
// name is the convention `run` enumerates.
tor __pump_main_retired_0 {}
__pump_main_retired_0() |> std/io:print.ln("a retired")
std/pump(main)
! step |> lib/flicker:a-step()
! live |> lib/flicker:a-live()
std/pump(main)
! step |> lib/flicker:b-step()
! live |> lib/flicker:b-live()
std/pump:run(main)
Supporting Files
// Two countdown participants — module-level burn counters behind the
// step/live surface. `a` burns out after `a` steps, `b` after `b` — enough to
// make one join cross to live() == 0 while the pump is still driven by the
// other.
const std = @import("std");
var a_left: i64 = 0;
var b_left: i64 = 0;
~pub tor light { a: i64, b: i64 }
~proc light|zig { a_left = a; b_left = b; }
~pub tor a-step {} -> i32
~proc a-step|zig { if (a_left > 0) { a_left -= 1; return 1; } return 0; }
~pub tor a-live {} -> i64
~proc a-live|zig { return a_left; }
~pub tor b-step {} -> i32
~proc b-step|zig { if (b_left > 0) { b_left -= 1; return 1; } return 0; }
~pub tor b-live {} -> i64
~proc b-live|zig { return b_left; }
Actual
a retired
all retired
Expected output
a retired
all retired
Flows
flow ~light click a branch to expand · @labels scroll to their anchor
light (a: 2, b: 4)
flow ~create click a branch to expand · @labels scroll to their anchor
create (expr: main)
flow ~__pump_main_retired_0 click a branch to expand · @labels scroll to their anchor
__pump_main_retired_0
flow ~std/pump click a branch to expand · @labels scroll to their anchor
std/pump (main)
flow ~std/pump click a branch to expand · @labels scroll to their anchor
std/pump (main)
flow ~run click a branch to expand · @labels scroll to their anchor
run (main)
Test Configuration
MUST_RUN
koru.json:
{
"name": "probe",
"version": "0.1.0"
}