✓
Passing This code compiles and runs correctly.
Code
// User code: taps tick from the counter library
// The loop lives in counter.kz - this just observes it
~import "$std/taps"
~import "$app/counter"
const std = @import("std");
~event log { n: u32 }
~proc log {
std.debug.print("tick {}\n", .{n});
}
~tap(app.counter:tick -> *)
| next v |> log(n: v.n)
Expected
tick 1
tick 2
tick 3
tick 4
tick 5
Actual
tick 1
tick 2
tick 3
tick 4
tick 5
Imported Files
// Library module: defines tick event and owns the loop
const std = @import("std");
~pub event tick { n: u32 }
| next { n: u32 }
| done
~proc tick {
if (n < 5) {
return .{ .next = .{ .n = n + 1 } };
}
return .{ .done = .{} };
}
// The loop lives here - user code taps it
~#loop tick(n: 0)
| next v |> @loop(n: v.n)
| done |> _
Test Configuration
MUST_RUN