✓
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");
~tor log { n: u32 }
~proc log|zig {
std.debug.print("tick {}\n", .{n});
}
~tap(app/counter:tick -> *)
| next v |> log(n: v)
Supporting Files
// JavaScript implementation facet. Events are declared in counter.kz (merged at
// import); this file holds the |js proc bodies.
~proc tick|js {
if (n < 5) {
return { tag: "next", next: n + 1 };
}
return { tag: "done" };
}
// Library module: defines tick event and owns the loop
const std = @import("std");
~pub tor tick { n: u32 }
| next u32
| done
~proc tick|zig {
if (n < 5) {
return .{ .next = n + 1 };
}
return .{ .done = .{} };
}
// The loop lives here - user code taps it
~#loop tick(n: 0)
| next v |> @loop(n: v)
| done |> _
Actual
tick 1
tick 2
tick 3
tick 4
tick 5
Expected output
tick 1
tick 2
tick 3
tick 4
tick 5
Flows
flow ~tap click a branch to expand · @labels scroll to their anchor
tap (app/counter: tick -> *)
Test Configuration
MUST_RUN