Stream: advent of code

Topic: Day 2


view this post on Zulip Tommy Graves (Dec 02 2022 at 05:40):

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.

view this post on Zulip Braydon Hall (Dec 02 2022 at 05:49):

Nice! I did the same thing but did the math in my head and hard-coded the result :joy:

view this post on Zulip Luke Boswell (Dec 02 2022 at 07:27):

Here is my Day 2 solution. I'm pretty happy with these parsers, felt really nice to work with. Thank you Roc devs!

view this post on Zulip Luke Boswell (Dec 02 2022 at 07:33):

@Tommy Graves that's nice and simple, love it!

view this post on Zulip Andy Kluger (Dec 02 2022 at 09:25):

My awkward Day 2

view this post on Zulip Ghislain (Dec 02 2022 at 11:47):

Even lazier than @Tommy Graves, very hardcoded solution :innocent:

view this post on Zulip Tommy Graves (Dec 02 2022 at 13:06):

Brilliant! Of course splitting the individual line is unnecessary :face_palm:‍♂️

view this post on Zulip Shritesh Bhattarai (Dec 02 2022 at 13:14):

lazy-ish, i guess

view this post on Zulip JesterXL (Dec 02 2022 at 14:46):

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

view this post on Zulip Tommy Graves (Dec 02 2022 at 16:20):

I made an alternative solution using tags to model the problem a bit: https://github.com/TAGraves/adventofcode2022/blob/main/day2_with_modeling.roc

view this post on Zulip Srinivas Rao-Mouw (Dec 02 2022 at 18:09):

My day 2 solution. Excited to see everyone else's tag system, I feel like mine is pretty repetitive.

view this post on Zulip Srinivas Rao-Mouw (Dec 02 2022 at 20:44):

stole your file loading logic @JesterXL , thank you

view this post on Zulip Ayaz Hafiz (Dec 02 2022 at 23:34):

My day 2 - man im loving this. here is parser.roc

view this post on Zulip Ayaz Hafiz (Dec 02 2022 at 23:38):

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.

view this post on Zulip JesterXL (Dec 02 2022 at 23:55):

@Srinivas Rao-Mouw I stole it from https://github.com/shritesh/advent/blob/main/2022/02.roc haha

view this post on Zulip Richard Feldman (Dec 03 2022 at 00:07):

we should totally add a List.findBy to builtins! :100:

view this post on Zulip Logan Lowder (Dec 04 2022 at 03:40):

Day2!
Think I'm starting to get the hang of it.


Last updated: Jul 06 2025 at 12:14 UTC