Style of ocaml snippet

I’ve written a very small snippet in ocaml, and what it does is return the linux function “lsbk” which does not exist on the freebsd o.s. It calls some system functions and put the results in an associative-array list.
Feel free to comment on the style used.

  1. I would recommend to switch to dune build system
    • It doesn’t encourage you to commit object files
    • In combination with VsCode add-on it will to autoformatting easily
    • It will allow you to test my linter experiment GitHub - Kakadu/mylinter
  2. Concatenation of string using ^ may be inefficient
  3. You are reinventing some functions from Stdlib
  4. Functional style usually avoids mutable references. Please, rewrite without them
  5. Identifiers with many underscores like ___ look weird. Do you really need a value called that in the scope?
1 Like