Day 8... Screw it... Python onwards...
Then I’ll probably fall back on Python. :)
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE Strict #-}
stateful s' f = runState f s'
forEach xs state' f = foldM f state' xs
solve input = forEach input initial_state $ \st current_value -> stateful st do
...I want to try again this year, do you have any advice for how to get going with Ocaml as someone who has programmed long enough to understand how recursion, linked lists, and all that jazz works, and just wants to figure out how to be productive in the language?
Guide: https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...
Reference: https://fsharp.github.io/fsharp-core-docs/
Also you can use F# notebooks with .NET Interactive and the Polyglot Notebooks Visual Studio Code extension, which is great for something like Advent of Code.
One downside of OCaml is that its standard library is not very powerful and there are multiple third party replacements that are popular. Jane Street's base/core, Containers, Batteries Included, to name a few. So you have to make a choice.
Having said that, I think you can live with the built in standard library to solve most of the AOC problems.
containers is my preferred “add batteries” std lib extension. Also, the ocaml discord chat and discuss forums are very active and welcome to questions