const std = #import("std");
const print = std.print;

const count_slice_byte_count = fn(slices: []const []const u8) usize {
    var byte_count: usize = 0;
    
    for (slices) |slice| {
        byte_count += slice.length;
    }

    return byte_count;
}

const print_values = fn(slice: []const u8) void {
    for (slice, 0..) |value, index| {
        std.print_usize(n = index);
        std.print(bytes = ": ");
        std.print_u8(n = value);
        std.print(bytes = "\n");
    }
}

const Error = error{
    unexpected_result,
};

const main = fn () Error!void {
    const a = [_]u8{1, 1, 4, 5, 6};
    const b = [_]u8{1, 4, 6};
    const expected_result: usize = a.length + b.length;
    const result = count_slice_byte_count(slices = .{a.&, b.&}.&);
    print_values(slice = a.&);
    if (expected_result - result != 0) {
        return Error.unexpected_result;
    }
}
