val implies =
fn x y = case x of false andalso case y of false => true
| fn x y = case x of false andalso case y of true => true
| fn x y = case x of true andalso case y of false => false
| fn x y = case x of true andalso case y of true => true;
I can't get this to compile. I'm relatively new to SML so not quite getting the general language and syntax. What have I done wrong?
There are various things wrong:
implies
to do pattern matching directly.case x of
is for pattern matching with specific values, not likeif/else
expression which accepts boolean expressions.fn x => ...
.A quick fix:
which can be rewritten for readability as:
or more concise by using propositional logic rule: