3 ms·
I am not trying to correct but clarify what you mean by unified syntax. In OCaml you can say let rec func = ... , let func = ..., let func = function |... | _-
by Dn_Ab 15y ago
I am not trying to correct but clarify what you mean by unified syntax.
In OCaml you can say let rec func = ... , let func = ..., let func = function |... | _->... and let func = fun ... -> ... Now I find that each of these variations make good sense and would call them unified facets but they tripped me up many years ago when I was first learning the language.
- tomp 15y agoThat's true, and there is also let func a b c = ..., and most of these are just syntax sugar, mainly useful at the module level. The important thing is, though, that the function declaration syntax is the same as the "inline" function syntax, I can easily say: let f = function 0 -> false | 1 -> true use (f) and then refactor the code into use (function 0 -> false | 1 -> true) That's the consistency I'm talking about...