Here's my day 2 solution. I opted to hardcode the cases instead of building any logic today because I wanted to try out list pattern matching and I'm lazy.
Nice! I did the same thing but did the math in my head and hard-coded the result :joy:
Here is my Day 2 solution. I'm pretty happy with these parsers, felt really nice to work with. Thank you Roc devs!
@Tommy Graves that's nice and simple, love it!
Even lazier than @Tommy Graves, very hardcoded solution :innocent:
Brilliant! Of course splitting the individual line is unnecessary :face_palm:♂️
My Day 2; I had fun with tags, and they helped find a compiler error, but just hardcoded to numbers https://github.com/JesterXL/advent-of-code-2022/blob/main/day2/main.roc
I made an alternative solution using tags to model the problem a bit: https://github.com/TAGraves/adventofcode2022/blob/main/day2_with_modeling.roc
My day 2 solution. Excited to see everyone else's tag system, I feel like mine is pretty repetitive.
stole your file loading logic @JesterXL , thank you
My day 2 - man im loving this. here is parser.roc
Does have me reaching for a List.findBy : List e -> (e -> [Found e, Unknown]) -> [Found e, Unknown])
function though. You can emulate it with walkTry
of course but that requires one more parameter and the Continue/Break wrapper tags.
@Srinivas Rao-Mouw I stole it from https://github.com/shritesh/advent/blob/main/2022/02.roc haha
we should totally add a List.findBy
to builtins! :100:
Day2!
Think I'm starting to get the hang of it.
Last updated: Jul 06 2025 at 12:14 UTC