[ANN] Advent of Code project template

Hey everyone!

I recently published a starter project for working on Advent of Code puzzles in OCaml:
https://github.com/Sixstring982/tanenbaum

It works for all “years” (and should work for 2023, assuming no API changes will be made tonight), and has some other nice features:

  • Automatic downloading + caching of puzzle inputs
  • CLI for running puzzles + submitting answers to adventofcode.com
  • Automatic puzzle detection + registration

Hope some folks find this useful – I’ve been using it a lot myself!

10 Likes

This sounds like an excellent idea. I know a lot of people experiment with a new language by testing out adventofcode.

3 Likes

This is a great project template! I am going to use it!

Anyone else had trouble using this template on OCaml 5, because of Piaf either requiring OCaml 4, or needing the project code to be ported from Lwt to Eio?

If you post details of the issues you encountered, people might be able to help solving them.

1 Like

The get_puzzle_input in lib/problem_runner.ml function uses Lwt_main, which Is not compatibile anymore with Piaf.

I got some compilation errors because Piaf.Client.Oneshot.get expects a ~sw parameter and, from there, I believe I was able to port the above function from Lwt_main to Eio_main.

The amazing thing is: once I got it to typecheck, I did not need any debugging.

Anyway, I hope I fixed the issue with this PR: Upgrade to OCaml 5 (Piaf 0.2.0 with Eio) by danilopiazza · Pull Request #4 · Sixstring982/tanenbaum · GitHub.

1 Like