using System.Collections; class SomeObj { id : int; public override GetHashCode () : int { id } public override Equals (other : object) : bool { other == this } static mutable cid : int; public this () { id = cid; cid++; } } module M { mutable cnt : int; mutable ar : array [SomeObj]; mutable ht : array[SomeObj]; test_ht () : void { ht = array(5); mutable n = 0; ht [n] = ar[1]; ++n; ht [n] = ar[3]; ++n; ht [n] = ar[7]; ++n; ht [n] = ar[5]; ++n; for (mutable i = 0; i < 10; ++i) { mutable seen = false; for (mutable j = 0; j < 5; ++j) when (ar [i] : object == ht [j]) seen = true; when (seen) ++cnt; } } public Main () : void { ar = array(20); for (mutable i = 0; i < 10; ++i) ar[i] = SomeObj(); for (mutable i = 0; i < 1000000; ++i) test_ht (); System.Console.WriteLine (cnt); } }