3 ms·
I would personally recommend trying out F#. :) Answers below are for F#. > For example, which sequence type should I be using most often? You should basically
by bmitc 3y ago
I would personally recommend trying out F#. :) Answers below are for F#.
> For example, which sequence type should I be using most often?
You should basically default to list. If you need assignment and indexing or a 2D structure, use array. If you're writing generic processing code, use sequences if you can. Use sequence if you need lazy sequences.
> And how often should I be using refs/mutability?
Only when you need. I most often use mutability when interacting with unmanaged code, translating some Python or other imperative code before transitioning it to be more functional, and inside classes to manage internal state. Otherwise, I don't.
> And there's lots of alternate stdlibs - should I be dipping into those?
I'm not familiar enough with the OCaml ecosystem, but F# doesn't have this problem. F# has its own core library and for everything else, you just reach out to .NET.
> What does unit testing typically look like for an OCaml project (and what about other forms of testing)?
I personally use FsUnit, specifically the XUnit flavor. https://fsprojects.github.io/FsUnit/xUnit.html https://fsprojects.github.io/FsUnit/xUnit.html. FsUnit is an F# DSL over NUnit and XUnit, so it fits in well with F# and functional thinking but also plugs into the IDEs and `dotnet test`.