use core {printf}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day1.txt";
+ contents := #file_contents "./input/day1.txt";
reader, stream := io.reader_from_string(contents);
defer cfree(stream);
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day10.txt";
+ contents := #file_contents "./input/day10.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day11.txt";
+ contents := #file_contents "./input/day11.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day12.txt";
+ contents := #file_contents "./input/day12.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day13.txt";
+ contents := #file_contents "./input/day13.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day14.txt";
+ contents := #file_contents "./input/day14.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day16.txt";
+ contents := #file_contents "./input/day16.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day17.txt";
+ contents := #file_contents "./input/day17.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day18.txt";
+ contents := #file_contents "./input/day18.txt";
file := contents;
total: u64 = 0;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day19.txt";
+ contents := #file_contents "./input/day19.txt";
file := contents;
use core {*}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day2.txt";
+ contents := #file_contents "./input/day2.txt";
reader, stream := io.reader_from_string(contents);
defer cfree(stream);
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day20.txt";
+ contents := #file_contents "./input/day20.txt";
file := contents;
allergen_map : map.Map(str, Allergen);
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day21.txt";
+ contents := #file_contents "./input/day21.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day22.txt";
+ contents := #file_contents "./input/day22.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day24.txt";
+ contents := #file_contents "./input/day24.txt";
file_stream := io.buffer_stream_make(contents);
file := io.reader_make(&file_stream);
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day25.txt";
+ contents := #file_contents "./input/day25.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day3.txt";
+ contents := #file_contents "./input/day3.txt";
forest := array.make(u8, 1024);
defer array.free(&forest);
// This does not include part 2 because it is gross and
// not worth the effort to implement it.
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day4.txt";
+ contents := #file_contents "./input/day4.txt";
valid_passports := 0;
while true {
use core {*}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day5.txt";
+ contents := #file_contents "./input/day5.txt";
vals := array.make(u32);
defer array.free(&vals);
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day6.txt";
+ contents := #file_contents "./input/day6.txt";
unique_sum := 0;
while true {
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day7.txt";
+ contents := #file_contents "./input/day7.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day8.txt";
+ contents := #file_contents "./input/day8.txt";
file := contents;
}
main :: (args: [] cstr) {
- contents := #file_contents "./tests/aoc-2020/input/day9.txt";
+ contents := #file_contents "./input/day9.txt";
file := contents;
--- /dev/null
+7
+foo => 123
+leet => 1337
--- /dev/null
+use core {*}
+
+main :: () {
+ arr := .[2, 3, 5, 7, 11];
+
+ x := 5;
+
+ val := slice.find_opt(arr, [n](n > x));
+ val->with([captured_name] {
+ println(captured_name);
+ });
+
+ m := Map.literal(str, i32, .[
+ .{ "foo", 123 },
+ .{ "leet", 1337 }
+ ]);
+
+ Map.each(m, [k, v] {
+ printf("{} => {}\n", k, v);
+ });
+}
+
+#inject Map {
+ each :: macro (m: $M, body: Code) {
+ for& m.entries {
+ #unquote body(it.key, it.value);
+ }
+ }
+}
+
+
+
+
+