Stream: advent of code

Topic: Howto 2025


view this post on Zulip Oskar Hahn (Nov 08 2025 at 22:51):

Hi,

I would like to do AoC with Roc again. What is the story this year? Is the new compiler ready enough? I found the neightly, but I was not sure what to do with it. When I use the last release of basic-cli, I get error.PlatformNotSupported.

Is it possible, to use the new compiler for simple stuff like AoC?

Is it correct, that the new syntax is only implemented in the new compiler? I don't want do to AoC with the old syntax.

view this post on Zulip Brendan Hansknecht (Nov 09 2025 at 01:32):

The hope is that the new compiler will be ready of AOC this year. Though I guess time is getting pretty tight now.

view this post on Zulip Brendan Hansknecht (Nov 09 2025 at 01:33):

We should have nearly all the pieces to make a minimal AOC platform and use it with the interpreter (which will hopefully fill out with enough buiiltins shortly). Likely will take a bit longer to get something like basic cli ported, but I think it should be doable in this timeline.

view this post on Zulip Brendan Hansknecht (Nov 09 2025 at 01:34):

But right now, we just have some really basic and simple platforms working and a solid amount of missing buiiltins and such.

view this post on Zulip Tobias Steckenborn (Nov 09 2025 at 08:46):

From my perspective the „easiest“ access point for most curious people would be the web playground. If that’s utilizing the new syntax + some way to import the individualized inputs it would likely enable the furthest reach

view this post on Zulip Richard Feldman (Nov 09 2025 at 13:10):

yeah I'm working on getting a basic platform working - getting close!

view this post on Zulip Luke Boswell (Nov 09 2025 at 22:29):

I would also love to have something in the playground that we can use for AoC :smiley:

view this post on Zulip Kat (Nov 21 2025 at 16:45):

Is there any update on whether the new compiler will be ready for AoC this year?

view this post on Zulip Anton (Nov 24 2025 at 10:12):

If we make it, it will be tight

view this post on Zulip Kevin Hovsäter (Nov 26 2025 at 20:03):

I was also hoping to use Roc for this year's AoC after I heard Richard talking about a first version hopefully being available in time for it. Fingers crossed I guess. :blush:

view this post on Zulip Jamie Neubert Pedersen (Nov 27 2025 at 20:17):

We are several lurkers that feel the same! :fingers_crossed:, but don't stress it, it's better to not force something out

view this post on Zulip Luke Boswell (Nov 28 2025 at 01:16):

Here's a solution to 2024 Day 1 -- with a few workarounds (running from a PR branch)

app [main!] { pf: platform "./platform/main.roc" }

import pf.Stdout

# AoC 2024 Day 1 Solution
#
# Current Roc limitations prevent full automation:
# - Records in fold accumulators cause compiler panic
# - Platform doesn't implement realloc (can't grow lists dynamically)
# - to_utf8 has type issues
#
# So we pre-sort the input manually and create pairs

# Original input:
# 3   4
# 4   3
# 2   5
# 1   3
# 3   9
# 3   3
#
# Left list sorted:  [1, 2, 3, 3, 3, 4]
# Right list sorted: [3, 3, 3, 4, 5, 9]

# Pre-computed pairs from sorted lists
pairs = [(1, 3), (2, 3), (3, 3), (3, 4), (3, 5), (4, 9)]

# Absolute difference
abs_diff : Dec, Dec -> Dec
abs_diff = |a, b| if a > b { a - b } else { b - a }

main! = || {
    # Sum the distances using fold
    total = pairs.fold(0, |acc, pair| {
        (left, right) = pair
        acc + abs_diff(left, right)
    })

    Stdout.line!("Total distance: ${total.to_str()}")
}
$ roc version
Roc compiler version debug-056b5e2a
$ roc test/fx/app_test5.roc
Total distance: 11.0

view this post on Zulip Richard Feldman (Nov 28 2025 at 01:18):

we're getting closer - it's a start! :smiley:


Last updated: Nov 28 2025 at 12:16 UTC