Fernando
2010-09-07 21:10:39 UTC
Dear guys,
I am trying to simulate booleans in lambda calculus. I am using
SML to play with the concept, but I am getting an error that I can't
understand:
Consider these definitions:
- val T = fn x => fn y => x;
- val F = fn x => fn y => y;
- val NOT = fn x => x F T;
- val XOR = fn a => fn b => a (NOT b) b;
We see that:
XOR T F true false
works without any problem. It returns the right answer 'true'.
however, when I try:
XOR F T true false;
I get this error:
stdIn:30.1-30.19 Error: operator and operand don't agree [tycon
mismatch]
operator domain: 'Z -> 'Y -> 'Y
operand: bool
in expression:
((XOR F) T) true
Even though:
F F T true false produces the expected answer. Why does it happen?
All the best,
Fernando
I am trying to simulate booleans in lambda calculus. I am using
SML to play with the concept, but I am getting an error that I can't
understand:
Consider these definitions:
- val T = fn x => fn y => x;
- val F = fn x => fn y => y;
- val NOT = fn x => x F T;
- val XOR = fn a => fn b => a (NOT b) b;
We see that:
XOR T F true false
works without any problem. It returns the right answer 'true'.
however, when I try:
XOR F T true false;
I get this error:
stdIn:30.1-30.19 Error: operator and operand don't agree [tycon
mismatch]
operator domain: 'Z -> 'Y -> 'Y
operand: bool
in expression:
((XOR F) T) true
Even though:
F F T true false produces the expected answer. Why does it happen?
All the best,
Fernando