unexpected output
Posted
by
tech-ref
on Stack Overflow
See other posts from Stack Overflow
or by tech-ref
Published on 2010-12-25T23:35:15Z
Indexed on
2010/12/25
23:54 UTC
Read the original article
Hit count: 503
hi, i wrote a function wich works as expected but i don't understand why the output is like that.
function
datatype prop = Atom of string | Not of prop | And of prop*prop | Or of prop*prop;
(* XOR = (A And Not B) OR (Not A Or B) *)
local
fun do_xor (alpha,beta) = Or( And( alpha, Not(beta) ), Or(Not(alpha), beta))
in
fun xor (alpha,beta) = do_xor(alpha,beta);
end;
test
val result = xor(Atom "a",Atom "b");
output
val result = Or (And (Atom #,Not #),Or (Not #,Atom #)) : prop
thanks again (specially zeuxcg)
© Stack Overflow or respective owner