, . , , :
let Calculate input =
let calc = function | [f] -> f input | fl -> fl |> List.map ((|>) input) |> List.sum |> (fun s -> s / fl.Length)
if input > 0 && input < 5
then calc [CalculateA; CalculateB]
else calc [CalculateC]
You can decompose something with this signature: ((int -> int) list) -> ((int -> int) list) -> (int -> bool) -> int -> intand then build your function by applying the first 3 parameters.
source
share