Stream: advent of code

Topic: Howto 2026


view this post on Zulip Oskar Hahn (Nov 19 2026 at 08:07):

I would like to do Advent of Code with Roc again this year.

I plan to use the built-in echo platform. I really like the idea that all the code for a single day is contained in one file.

A template could look like this:

template file

My repo will be here

Are you also doing Advent of Code this year, or has it lost its appeal in the age of AI?

view this post on Zulip Luke Boswell (Nov 19 2026 at 09:12):

It might be fun to use Roclet
https://ageron.github.io/roclet/

view this post on Zulip Luke Boswell (Nov 19 2026 at 09:13):

I will 100% be doing AoC this year :grinning_face_with_smiling_eyes:

Its good fun.

view this post on Zulip Anton (Nov 19 2026 at 10:59):

or has it lost its appeal in the age of AI?

I don't think so, I suspect most participants will be doing it the old fashioned way for the challenge.

view this post on Zulip Tobias Steckenborn (Nov 19 2026 at 17:31):

Any chance of getting the https://roc-lang.github.io/roc-playground/ to the latest and greatest for aoc? Could be cool also with "share link", being able to easily share the solutions.

view this post on Zulip Anton (Nov 19 2026 at 19:33):

Good idea @Tobias Steckenborn! I'll update it

view this post on Zulip Luke Boswell (Nov 19 2026 at 20:06):

@Tobias Steckenborn have you tried Roclet?

view this post on Zulip Tobias Steckenborn (Nov 19 2026 at 20:07):

not yet

view this post on Zulip Anton (Nov 20 2026 at 10:17):

Playground is up to date now :)

view this post on Zulip Johannes Maas (Nov 22 2026 at 11:06):

@Luke Boswell Roclet looks great! The Roc Playground, too! I'm missing autocomplete for functions name though, so I prefer to code in my IDE for now.

This lead me to creating a harness for solving AoC. If anyone finds it useful, just clone the repo and hack away: https://github.com/j-maas/roc-aoc?tab=readme-ov-file

view this post on Zulip Dan G Knutson (Nov 22 2026 at 16:45):

I'm also planning to do this, and I've been doing some old problems with the echo platform here:
https://github.com/Giesch/advent-2015

My impression is that there's fewer people interested in AoC, but the people interested in it are doing weirder stuff with their solutions. Like solving problems in the gnu calculator or whatever.

view this post on Zulip Vanand Gasparyan (Nov 23 2026 at 10:22):

I do AoC to learn a new language every year. This time it's Roc. I'm confused though, what do you mean by "echo platform"? I thought basic-cli and basic-webserver are platforms, and I don't see any platform import in your repos. Also, I don't see why a platform is needed for AOC-style problems.

view this post on Zulip Luke Boswell (Nov 23 2026 at 10:24):

Roc has a default or builtin platform that is very simple and has only a single effect, echo! which prints to stdout. It's available without a URL to download or reference a platform -- like a platform-less (or even headerless if you want) app.

view this post on Zulip Luke Boswell (Nov 23 2026 at 10:25):

This is a complete file... example.roc

main! = |_args| {
    echo!("Hello world")
    Ok({})
}
$ ~/roc-macos_apple_silicon-0.1.0_RC1/roc example.roc
Hello world

view this post on Zulip Luke Boswell (Nov 23 2026 at 10:28):

You could use this for AoC if you wanted... pair it with import for your input file https://www.roc-lang.org/examples/IngestFiles/README and you should be off to the races

view this post on Zulip Vanand Gasparyan (Nov 23 2026 at 10:36):

Understood, thanks! I know I could do echo! without a platform, in my mind that was the "platform-less" setup. Thanks for the clarification.

And btw, this import is a cool feature!

view this post on Zulip Vanand Gasparyan (Nov 23 2026 at 13:22):

https://www.roc-lang.org/examples/IngestFiles/README

import "some-file.txt" as some_str : Str
import "some-file" as some_bytes : List(U8)

Interesting, can one do this?

import "some-file.txt" as some_lines : List(Str)

view this post on Zulip Anton (Nov 23 2026 at 13:45):

I think it needs to be Str or List(U8)

view this post on Zulip Oskar Hahn (Nov 23 2026 at 22:00):

Sincen roc has comptime evaluation, you can import the file as str and then write

as_lines = some_str.split_on("\n")

view this post on Zulip Luke Boswell (Nov 23 2026 at 22:01):

haha, if you're not careful the whole solution might be ran at compile time :sweat_smile:

view this post on Zulip Hardy (Nov 24 2026 at 11:20):

Interesting point. I'm curious, any hints what would stop the compiler from evaluating everything at compile time. i.e. when the input got imported it is hardcoded and by the nature of aoc I would suspect that the result is determenistic from its input so what should stop compile time evaluation?

view this post on Zulip Luke Boswell (Nov 24 2026 at 11:21):

if you make it a thunk then call it at runtime, so I think something like this

import ... as some_str : Str

my_runtime_calc = || { ... # do something with some_str }

main! = || { ...

my_runtime_calc is a lambda/function .. so it wont be evaluated until runtime when you call it

view this post on Zulip Luke Boswell (Nov 24 2026 at 11:24):

I'm not sure though... the semantics around these features as evolved a lot. I would probably test it out using basic-cli and some clock measurements. But its getting late here.

view this post on Zulip Hardy (Nov 24 2026 at 11:26):

Ah, yes I might should have guessed that.
No need to try I guess 1 Dez will give us the chance to find out.

view this post on Zulip Hardy (Nov 24 2026 at 11:28):

Basically who can get all aoc solutiouns run with the same max time which is technically only printing the result :joy:

view this post on Zulip Jake Keller (Nov 24 2026 at 16:40):

I'm also looking forward to trying out Roc for AoC this year (it will be my first time using the language)!

I do have several questions though, namely:

  1. Are there any meaningful downsides to using the echo platform, or will it be (more than?) sufficient for AoC?
  2. The Str class is still a bit of a mystery to me -- would it be best to just use List(U8) for AoC things?
  3. How do people manage Roc versions? With the impending 0.1.0 release (and patches leading up to it) this is something I want to be conscious of.
  4. Are there any good repos/projects/whatever to reference to get a feel of Roc? I learn best by doing (thus doing AoC) but some pattern matching is always helpful.

I guess these questions may be better(?) suited for the #beginners channel... let me know if I should post there instead.

view this post on Zulip Johannes Maas (Nov 24 2026 at 16:49):

In regards to 1: It's definitely not needed. The only reason I used the basic-cli platform in my AoC harness is to have access to the Utc module for measuring time. Otherwise it only uses Stdout, which is what echo does.

view this post on Zulip Anton (Nov 24 2026 at 16:57):

Hi @Jake Keller,

  1. The Str class is still a bit of a mystery to me -- would it be best to just use List(U8) for AoC things?

That should work fine :)

Are there any good repos/projects/whatever to reference to get a feel of Roc?

We have a nice selection of examples here and the Roc Exercism track is an excellent way to get learning by doing.

view this post on Zulip Anton (Nov 24 2026 at 17:00):

  1. How do people manage Roc versions? With the impending 0.1.0 release (and patches leading up to it) this is something I want to be conscious of.

rocup is a community tool for this. It may not support release candidate releases yet @Ian McLerran

view this post on Zulip Jake Keller (Nov 24 2026 at 17:02):

Thanks @Johannes Maas and @Anton for the responses, they're very helpful!

I forgot to mention, but the possibility of solving the whole puzzle at comptime is pretty cool. My friends and I sometimes compete on solution speed as well... so that could be quite a fun party trick :smile:


Last updated: Nov 26 2026 at 20:35 UTC