✓
Passing This code compiles and runs correctly.
Code
~import std/io
const std = @import("std");
var input_n: u64 = 0;
~pub event read-n {}
~proc read-n|zig {
var args = std.process.args();
_ = args.next();
if (args.next()) |arg| {
input_n = std.fmt.parseInt(u64, arg, 10) catch 1_000_000;
} else {
input_n = 1_000_000;
}
}
~pub event ticker { n: u64 }
! tick { item: u64, acc: u64 } -> u64
! tock { item: u64, acc: u64 } -> u64
| done { ticks: u64, tocks: u64 }
~proc ticker|zig {
var ticks: u64 = 0;
var tocks: u64 = 0;
for (0..n) |i| {
if (i % 2 == 0) {
ticks = tick(.{ .item = i, .acc = ticks });
} else {
tocks = tock(.{ .item = i, .acc = tocks });
}
}
return .{ .done = .{ .ticks = ticks, .tocks = tocks } };
}
~read-n()
~ticker(n: input_n)
! tick p -> p.acc + 1
! tock p -> p.acc + 1
| done r |> std/io:print.ln("ticks = {{ r.ticks:d }} tocks = {{ r.tocks:d }}")
Actual
ticks = 50 tocks = 50
Expected output
ticks = 50 tocks = 50
Flows
flow ~read-n click a branch to expand · @labels scroll to their anchor
read-n
flow ~ticker click a branch to expand · @labels scroll to their anchor
ticker (n: input_n)
Test Configuration
MUST_RUN