Stream: roctoberfest

Topic: Day 10


view this post on Zulip Brendan Hansknecht (Oct 09 2022 at 00:12):

Just did day 10. Actually used a tag for once. Overall was quite straightforward: https://github.com/bhansconnect/roc-aoc-2021/blob/trunk/day10/part2.roc

In the last 2 problems, I defined a crash helper for simplicity. probably could be written better:

crash : a -> a
crash = \a -> crashInternal (0 - 1) a

crashInternal : U8, a -> a
crashInternal = \_, a -> a

view this post on Zulip Brendan Hansknecht (Oct 09 2022 at 00:13):

Also, I feel the more pipelining I do, the less backpassing I do. I guess it is backpassing for tasks and pipelining for data manipulation.

view this post on Zulip Ayaz Hafiz (Oct 09 2022 at 00:15):

you could make crash simpler as just

crash : {} -> a

and leave the body unimplemented

view this post on Zulip Richard Feldman (Oct 09 2022 at 00:18):

or if you want a body (for some reason):

crash : {} -> *
crash = \{} -> if 0u8 - 1 > 0 then crash {} else crash {}

view this post on Zulip Brendan Hansknecht (Oct 09 2022 at 01:54):

Without a body wouldn't roc check fail?

view this post on Zulip Brendan Hansknecht (Oct 09 2022 at 01:55):

And roc dev

view this post on Zulip Ayaz Hafiz (Oct 09 2022 at 01:59):

no

view this post on Zulip Brendan Hansknecht (Oct 09 2022 at 02:10):

I am very confused... Why is an undefined function with only a prototype not a warning?

view this post on Zulip Brian Carroll (Oct 09 2022 at 15:45):

I believe the idea is to let you sketch out a design for a program and get parts of it working. The undefined function bodies get replaced with roc_panic I think

view this post on Zulip Richard Feldman (Oct 09 2022 at 16:42):

yeah, although we should probably give a reminder somehow

view this post on Zulip Richard Feldman (Oct 09 2022 at 16:42):

maybe a little note at the end like: "these functions don't have implementations yet: Foo.bar, Baz.blah, ..."

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

sure, but roc check is supposed to fail CI on warnings or errors. I think not defining a function is something worth failing CI over.

view this post on Zulip Brian Carroll (Oct 09 2022 at 16:55):

Good point!

view this post on Zulip Ghislain (Oct 22 2022 at 22:10):

https://github.com/ghigt/advent-of-code/tree/main/roc/day-10
An easy one (or I'm better than before :sweat_smile:)
Looks like challenge motivation has been lost, I will probably continue without notify. It has been very entertaining and instructive to do it, lot of progress done. My brain is now directly thinking in Roc instead of Go or JS. Looking forward for easier debug and editor type help for AoC 2022 :innocent:

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

Yeah, we are apparently like regular advent if code people. Day ten is a far way to make it.

view this post on Zulip Anton (Oct 23 2022 at 07:52):

Looking forward for easier debug and editor type help for AoC 2022 :innocent:

editor type help will unfortunately not be ready for AoC 2022, we had this working for small programs but we have a big rewrite planned of an important part of the editor. So it does not make sense to try to expand type help before that because we'd have to throw a lot of it out.


Last updated: Jul 06 2025 at 12:14 UTC