type animal = Cat | Dog
type action = Sound | Eat | Attack
let cat_sound () = printf "meow"
let cat_attack () = printf "scratch"
let dog_sound () = printf "woof"
let act animal action = match animal,action with
| Cat, Sound -> cat_sound ()
| Cat, Attack -> cat_attack ()
| Dog, Sound -> dog_sound ()
Compiling this yields: Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(Dog, (Eat|Attack))
just as we'd like.
where f,g are the guesses and a,b are the flips. Each guess is a function of the information available to the respective player -- the outcome of his own coin flip. There's only 4 unary boolean functions:
The constant functions are out and order doesn't matter, so we're left with
Here I just tried (id,not) first, but 3 choices are easy to check exhaustively.