I’d like to add my 2 cents on what makes a program more understandable than another:
- A simpler structure
- Hints for interpreting the intended behavior
Regarding point 1: Code length is not a good metric for those. Replacing
(fun x -> f (g x)) with e.g.
f <.> g does not simplify the structure of the program in any meaningful way. I suppose it can be useful in specific applications where the operator is used a lot in one specific module, but in this case it’s straightforward to define it locally. In my experience, such custom operators are never exactly function composition and we end up defining custom operators anyway.
Regarding point 2: Hints for interpreting intended behavior in OCaml and other text-based programming systems include pseudo-English names, comments, and consistency with the rest of the program. Mathematical symbols with a universal meaning could be treated as names, but that’s not the case for