mirror of
https://github.com/MorizzG/aoc-2024.git
synced 2025-12-06 04:22:43 +00:00
day 5 finished
This commit is contained in:
parent
a79e53da57
commit
6178c3f3f6
2 changed files with 233 additions and 123 deletions
22
utils.zig
22
utils.zig
|
|
@ -21,13 +21,35 @@ pub fn range(alloc: std.mem.Allocator, n: usize) ![]usize {
|
|||
}
|
||||
|
||||
pub fn printSlice(comptime T: type, slice: []const T) void {
|
||||
if (slice.len == 0) {
|
||||
std.debug.print("[ ]", .{});
|
||||
return;
|
||||
}
|
||||
|
||||
std.debug.print("[ ", .{});
|
||||
|
||||
for (slice[0 .. slice.len - 1]) |x| {
|
||||
std.debug.print("{}, ", .{x});
|
||||
}
|
||||
|
||||
std.debug.print("{} ]", .{slice[slice.len - 1]});
|
||||
}
|
||||
|
||||
pub fn printlnSlice(comptime T: type, slice: []const T) void {
|
||||
if (slice.len == 0) {
|
||||
std.debug.print("[ ]\n", .{});
|
||||
return;
|
||||
}
|
||||
|
||||
std.debug.print("[ ", .{});
|
||||
|
||||
for (slice[0 .. slice.len - 1]) |x| {
|
||||
std.debug.print("{}, ", .{x});
|
||||
}
|
||||
|
||||
std.debug.print("{} ]\n", .{slice[slice.len - 1]});
|
||||
}
|
||||
|
||||
pub const FileReader = struct {
|
||||
const BufferedReader = std.io.BufferedReader(4096, std.fs.File.Reader);
|
||||
const Reader = std.io.Reader(*BufferedReader, std.fs.File.Reader.Error, BufferedReader.read);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue