Stream: advent of code

Topic: 2024 Day 4


view this post on Zulip jan kili (Dec 04 2024 at 06:27):

:partying_face: https://gitlab.com/JanCVanB/aoc-2024/-/blob/main/day-04/part-1/main.roc

view this post on Zulip Luke Boswell (Dec 04 2024 at 06:28):

I need to afk for a few hours... but figured I'd share my part 1 :smiley:

edit nvm part 2 was easy

https://github.com/lukewilliamboswell/aoc/blob/main/2024/04.roc

TIMING:
READING INPUT:  <1ms
SOLVING PART 1: 49ms
SOLVING PART 2: 8ms

view this post on Zulip jan kili (Dec 04 2024 at 06:52):

lol it seems rough from my approach

view this post on Zulip Oskar Hahn (Dec 04 2024 at 07:32):

Here is mine: https://github.com/ostcar/aoc2024/blob/main/day04.roc

I used the array2d package. It uses backpassing, which results in my program to show warnings, that backpassing is deprecated.

Is there already a discussion, if warnings from dependent packages should be shown when compiling an application?

view this post on Zulip Ryan Barth (Dec 04 2024 at 07:49):

It's so fun to see people's different styles. Here is mine for today.
https://github.com/r-bar/advent24/blob/master/day04/p2.roc

view this post on Zulip Ryan Barth (Dec 04 2024 at 07:55):

I feel like I am starting to be able to pick out which roc code belongs to who from the people who have kept posting in here each day.

view this post on Zulip jan kili (Dec 04 2024 at 08:27):

Dang, I finished writing my part 2 code a half hour ago but can't figure out why my non-example answer is wrong :/
Grrr. Oh well. Bedtime!

view this post on Zulip Anton (Dec 04 2024 at 10:21):

Is there already a discussion, if warnings from dependent packages should be shown when compiling an application?

They should not, there is already on issue for it #6700

view this post on Zulip Nicola Peduzzi (Dec 04 2024 at 10:53):

Part 1 done. I'm glad I did it with support functions now that I see part 2 :D hopefully now it should only be a composing thing

https://github.com/thenikso/advent-of-code-2024-roc/blob/main/04.roc

view this post on Zulip Anthony Bullard (Dec 04 2024 at 13:54):

Those of you done already are either a) From the Eastern Hemisphere, or b) Very committed :smiley:

view this post on Zulip Robin Camarasa (Dec 04 2024 at 14:21):

https://github.com/RobinCamarasa/Advent-of-code/blob/master/2024/day04/RobinCamarasa/main.roc . Really enjoying doing AOC in roc. I am not only understanding roc better but also get inspiration on how to make a smarter use of error as value in general. And this is 100% thanks to the great naming of the standard library functions :smile:

view this post on Zulip Anthony Bullard (Dec 04 2024 at 15:56):

Loved part 1, will do part 2 after work

view this post on Zulip Asbjørn Olling (Dec 04 2024 at 18:13):

https://gitlab.com/AsbjornOlling/aoc2024/-/blob/main/04/main.roc?ref_type=heads

Was going to do advent of code in python this year (all my friends are, and it's fun to compare)- but I got bored with it yesterday and switched back to Roc.

There sure is a lot of new stuff since I used Roc for aoc last year!
I managed to do todays without faffing with results too much, but I'd like to mess around with the ? operator soon.

The Array2D.subarray function sure was useful for part 2 today. It sucks with the backpassing deprecation warnings though. Maybe someone should try making a PR :thinking:

view this post on Zulip Anthony Bullard (Dec 04 2024 at 18:22):

Couldn't wait. Was able to do part 2 over lunch:

https://github.com/gamebox/aoc-2024/blob/main/day4/puzzle1/main.roc
https://github.com/gamebox/aoc-2024/blob/main/day4/puzzle2/main.roc

Very fun exercise.

view this post on Zulip Luke Boswell (Dec 04 2024 at 19:12):

It sucks with the backpassing deprecation warnings though. Maybe someone should try making a PR

I fixed it, I can make a PR

view this post on Zulip Luke Boswell (Dec 04 2024 at 19:17):

@Elias Mulhall https://github.com/mulias/roc-array2d/pull/9

view this post on Zulip Elias Mulhall (Dec 04 2024 at 22:26):

Okey dokey, https://github.com/mulias/roc-array2d/releases/tag/v0.3.1 should be warning free, and I updated the examples to run with roc nightly!

view this post on Zulip Isaac Van Doren (Dec 06 2024 at 05:18):

https://github.com/isaacvando/aoc/blob/main/2024/4.roc

view this post on Zulip Eli Dowling (Dec 09 2024 at 06:07):

https://github.com/faldor20/aoc-template/blob/purity-inference/examples/2024/04.roc FInally got mine done too.
I was super happy about part 1.
part 2 I just kind of threw together :sweat_smile:

view this post on Zulip Anton (Dec 10 2024 at 16:58):

@Anthony Bullard asked for a recording of me using the Roc agent, so here it is:
aoc-2024-4-2024.mkv
I did not have to make any changes to the prompt so it was not very eventful :p
The sonnet 3.5 servers did get overloaded, so I switched to haiku but it made a copy paste error, later I was just able to switch back to sonnet. The bottom line of my terminal also got cut off, sorry about that.

Claude's solution:
main_claude.roc

view this post on Zulip Brendan Hansknecht (Dec 10 2024 at 17:09):

Out of my own curiosity, can you have it do day nine and measure the perf?

view this post on Zulip Anton (Dec 10 2024 at 17:17):

Yeah totally :) can I just use Luke's default aoc-template measurement?

view this post on Zulip Anton (Dec 10 2024 at 17:21):

Also, should I measure with or without --optimize?

view this post on Zulip Brendan Hansknecht (Dec 10 2024 at 17:24):

yes and with optimize


Last updated: Jul 06 2025 at 12:14 UTC