For this problem, I would use the answer suggested by mydogisbox, but if this question is a backup for a more complex real problem or there is some other reason why you should use pattern matching, you can do something like this:
let (|A|B|C|X|) stringValue = let compare x = compareCaseInsensitive stringValue x match List.map compare ["a"; "b"; "c"] with | [true; _; _] -> A | [_; true; _] -> B | [_; _; true] -> C | _ -> X stringValue
This is definitely not the method that I would use in the case of a question posted , but perhaps it can inspire a solution if there is a more complex underlying problem.
source share