How can I create a partial function application for a non-symmetric operator such as the modulus operator with regards to the first argument without any argument names in F#? My first attempt was
let mod10 = (%) 10 which of course translates to
mod10(x) = 10 mod x instead of the desired
mod10(x) = x mod 10.
Certainly I could write
let mod10 x = (%)x 10 but I’d like to not have to name the argument so is there some placeholder that can be used, something like
let mod10 = (%)_ 10?
You can define
flipfunction which is common in point-free style:and use it like this:
or directly like this:
Point-free style is not always readable (as in this example) and not popular in F# programming.