3 ms·
In OCaml, a common convention is often to use functions with names like int_of_float (or Int.of_float), although it is also likely that (e.g.) the Int module wi
by dan-robertson 4y ago
In OCaml, a common convention is often to use functions with names like int_of_float (or Int.of_float), although it is also likely that (e.g.) the Int module will have a to_float function too. I write a lot of OCaml and it still trips me up from time to time.
The other solution in a procedural/functional language is to write code closer to the evaluation order, e.g. with a 'pipeline' operator:
let myoklch =
mycolor
|> lin_proPhoto
|> lin_proPhoto_to_XYZ
|> ...
or with a 'fluent' interface in an OOP language:
let myoklch =
mycolor.to_linear().to_XYZ().to_D65().to_OKLAB().to_OKLCH();