Bug in equality testing?

John Harrison (John.Harrison@cl.cam.ac.uk)
Sun, 20 Mar 94 15:24:23 +0000

To: caml-list@pauillac.inria.fr
Subject: Bug in equality testing?
Date: Sun, 20 Mar 94 15:24:23 +0000
From: John Harrison <John.Harrison@cl.cam.ac.uk>
Message-Id: <"swan.cl.cam.:202150:940320152434"@cl.cam.ac.uk>

Hi,

I've come across the following, which unless I am being stupid
looks like a bug. The program below produces (in 0.6):

true; true; false

John.

P.S. Thanks for the interesting replies on hash-consing. I'm afraid
I am likely to be pestering you with more questions about CAML soon.
It's a great system!

**********************************************
type Example = Var of string
| App of string * Example list;;

let DEST =
fun (App p) -> p
| (Var _) -> failwith "DEST";;

let a = DEST(App("X",([]: Example list)));;
let b = ("X",([]: Example list));;

fst(a) = fst(b);;
snd(a) = snd(b);;
a = b;;
**********************************************