Stream: roctoberfest

Topic: Day 9


view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 16:22):

Day 9 wasn't too bad. I probably should have reached for results or optoinals for some things instead of branches with one side being a crash. Debugability wasn't great. Had a panic due to a typo (subtraction where I should have had addition). Would be solved if the cli platform printed a bracktrace when roc panicked.

https://github.com/bhansconnect/roc-aoc-2021/blob/trunk/day9/part2.roc

view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 16:52):

Added a pr to give us backtraces on the cli platform: https://github.com/roc-lang/roc/pull/4258

view this post on Zulip Richard Feldman (Oct 08 2022 at 19:02):

I made some cosmetic cleanups to the trace! Screen-Shot-2022-10-08-at-3.01.45-PM.png

view this post on Zulip Richard Feldman (Oct 08 2022 at 19:04):

PR: https://github.com/roc-lang/roc/pull/4261

view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 21:15):

That's awesome!

view this post on Zulip Ghislain (Oct 21 2022 at 00:44):

https://github.com/ghigt/advent-of-code/blob/main/roc/day-9/part2.roc
I thought it was an easy one, but I'm stuck on the part2 :sob:
I compared each values of part1 with @Brendan Hansknecht solution and I have the same one, I tried my part2 with the example and I get the good result but for the real data, I get a wrong answer. If someone understand what's wrong in my implementation, I would be happy to know!

view this post on Zulip Brendan Hansknecht (Oct 21 2022 at 04:42):

Only gave it a short scan, with no testing, but this line looks wrong to me: https://github.com/ghigt/advent-of-code/blob/f105bd13bdfd757913ab0d38d2a5d9b02002c300/roc/day-9/part2.roc#L55

Should y.x == x + 1 be y.x > x?

view this post on Zulip Brendan Hansknecht (Oct 21 2022 at 04:43):

maybe should even be >=, but I would need to re-look at the problem

view this post on Zulip Ghislain (Oct 21 2022 at 08:57):

You're absolutely right, I didn't understand the instruction. :man_facepalming: so close... :sweat_smile: thank you!


Last updated: Jul 06 2025 at 12:14 UTC