I just implemented day 4 in what feels like a slightly silly way. That being said, it was quite fun to implement this way even if it is doing work it really shouldn't be. The solution felt nice to write.
code: https://github.com/bhansconnect/roc-aoc-2021/blob/trunk/day4/part1.roc
I feel like I am really starting to fully grok heavily pipelined solutions.
Day 4 Part 1: Backpass all the things. https://github.com/shritesh/advent/blob/main/2021/4.roc. Sets in the stdlib made this a breeze
Part 2 is just part 1 flipped inside out: https://github.com/shritesh/advent/blob/main/2021/4.roc
I've tried my best to error instead of default values, which kinda feel icky. Also, loving that I don't have to write any type annotations at all. Hopefully the editor does this automatically in the future.
I didn't think I would make it to the end, but finally after a surprising "segfault" it all works!
https://github.com/ghigt/advent-of-code/tree/main/roc/day-4
I've been a bit frustrated to unwrap values from inside a Tag. I don't know how to do it without a when
.
Last updated: Jul 06 2025 at 12:14 UTC