Time for my yearly tradition of making it to day 4 in Haskell and feeling very smart before completely giving up on the first hard problem that needs regular arrays :)
I know exactly what you mean. I'm going to try AoC this year again with Haskell, but this time around I'm just going to cheat and use it as an imperative language.
{-# 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 tried that last year, and got worn down by how often I'd Google how to do something and get an answer explaining how recursion works from first principles as opposed to just pointing at the deciding standard library function that did what I needed.
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?
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.
I'm not an OCaml expert either. I've used Haskell professionally a little bit and also know OCaml. I find OCaml more practical because you don't have to fight with "pure" functional programming when you really want an imperative algorithm. For example, OCaml provides mutable arrays even though it encourages functional style whenever possible.
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.
I did OCaml the passed two years. GPL productivity in OCaml is easily accessible, but you need opam packages. Its not a deeply batteries-included language at all. With the exception of eio, my goto set of base packages are: https://github.com/cdaringe/protohacks/blob/main/dune-projec...
containers is my preferred “add batteries” std lib extension. Also, the ocaml discord chat and discuss forums are very active and welcome to questions