Stream: roctoberfest

Topic: Day 8


view this post on Zulip Ayaz Hafiz (Oct 07 2022 at 21:39):

Day 8 was frustrating, but not for Roc reasons - I just don't really like the problem that much. On the Roc side I found myself really reaching for a crash/unreachable function, which I wrote here - it's just not useful to model the data in such a specific way as to not have to use it, IMO. I think the parser I wrote was the most interesting part of today. The combinator library is coming along nicely

view this post on Zulip Ayaz Hafiz (Oct 07 2022 at 21:40):

Also having to write two separate functions for get-or-crash for Dict and List (https://github.com/ayazhafiz/roc-advent-of-code/blob/28c22ef3a242e9915f22b005fa197aebe1d7971b/2021/day8.roc#L137-L145) had me reaching for higher kinds a bit.. but not enough for it to matter

view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 05:10):

Just read the first part of the problem. I can immediately see why it would be frustrating.

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

Just finished day 8. Was not horrid, but was definitely annoying: https://github.com/bhansconnect/roc-aoc-2021/blob/trunk/day8/part2.roc

view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 06:14):

One main thing that bit me was forgetting that == does not do what you would expect on a set. It compares the underlying lists in order rather than comparing the sets.

view this post on Zulip Richard Feldman (Oct 08 2022 at 06:24):

I forget what we decided about that :sweat_smile:

view this post on Zulip Richard Feldman (Oct 08 2022 at 06:26):

like whether == on sets and dictionaries should ignore insertion order, even though that would mean a == b would not imply walk a state fn == walk b state fn for dictionaries and sets

view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 06:38):

Since we are allowing user defined types to implement the Eq ability and get a custom ==, we will also change == on sets and dictionaries to ignore insertion order.

view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 06:38):

I think that was more or less the last state of discussion

view this post on Zulip Brendan Hansknecht (Oct 08 2022 at 06:40):

Of course we will have a insertion order perserving set and dict, so at least construction more clearly defines ordering.

view this post on Zulip Ghislain (Oct 18 2022 at 13:32):

https://github.com/ghigt/advent-of-code/blob/main/roc/day-8/part2.roc
This one was definitely not funny...
I find the need for an integrated editor, I've been lost several times in the algorithm.
Thanks to @Folkert de Vries I discovered that expect can be helpful outside functions (waiting for issue 4093).

I still find coding in JS/TS easier because of the vscode help on current types. I find myself coding differently by easily "console.loging" each functions. In Roc, my brain is lazy on writing a long Dict/Set to tests function calls.

I like finding definition of functions in the repl, but it fails on some calls (eg. Dict.get, Dict.update...). Would also be happy to have the doc associated with it :sweat_smile:


Last updated: Jul 06 2025 at 12:14 UTC