Is there a standard way of logically combining predicates in F#?
For example, let\'s say I have isCar x
and isBlue x
then I want something that gives m
You could do something like the following:
let predicates = [isCar; isBlue]
let isBlueCar x = predicates |> List.forall (fun predicate -> predicate x)
More generally:
let combinePredicates predicates =
fun x -> predicates |> List.forall (fun predicate -> predicate x)
let isBlueCar = combinePredicates [isCar;isBlue]