Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Bug in equality testing?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Harrison <John.Harrison@c...>
Subject: Bug in equality testing?


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


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;;