anchor.diff:          SetTree.isEmpty s.Tree
   
       member s.Partition f : Set<'T> *  Set<'T> = 
  -        match s.Tree with 
  -        | SetEmpty -> s, s
  -        | _ -> let t1, t2 = SetTree.partition s.Comparer f s.Tree in Set(s.Comparer, t1), Set(s.Comparer, t2)
  +        if SetTree.isEmpty s.Tree then s,s
  +        else
  +            let t1, t2 = SetTree.partition s.Comparer f s.Tree in Set(s.Comparer, t1), Set(s.Comparer, t2)
   
       member s.Filter f : Set<'T> = 
  -        match s.Tree with 
  -        | SetEmpty -> s
  -        | _ -> Set(s.Comparer, SetTree.filter s.Comparer f s.Tree)
  +        if SetTree.isEmpty s.Tree then s
  +        else
  +            Set(s.Comparer, SetTree.filter s.Comparer f s.Tree)
   
       member s.Map f : Set<'U> = 
           let comparer = LanguagePrimitives.FastGenericComparer<'U>
  -        Set(comparer, SetTree.fold (fun acc k -> SetTree.add comparer (f k) acc) (SetTree<_>.SetEmpty) s.Tree)
  +        Set(comparer, SetTree.fold (fun acc k -> SetTree.add comparer (f k) acc) (SetTree.empty) s.Tree)
   
       member s.Exists f =
           SetTree.exists f s.Tree
  
positive.code:               member __.Dispose() = () }
  
      /// Set comparison.  Note this can be expensive.
      let rec compareStacks (comparer: IComparer<'T>) l1 l2 =
          match l1, l2 with 
          | [], [] ->  0
          | [], _  -> -1
          | _, [] ->  1
          | (SetEmpty  _ :: t1), (SetEmpty    :: t2) -> compareStacks comparer t1 t2
          | (SetOne n1k :: t1), (SetOne n2k :: t2) -> 
               let c = comparer.Compare(n1k, n2k) 
               if c <> 0 then c else compareStacks comparer t1 t2
          | (SetOne n1k :: t1), (SetNode (n2k, SetEmpty, n2r, _) :: t2) -> 
               let c = comparer.Compare(n1k, n2k) 
               if c <> 0 then c else compareStacks comparer (SetEmpty :: t1) (n2r :: t2)
          | (SetNode (n1k, (SetEmpty as emp), n1r, _) :: t1), (SetOne n2k :: t2) -> 
               let c = comparer.Compare(n1k, n2k) 
               if c <> 0 then c else compareStacks comparer (n1r :: t1) (emp :: t2)
          | (SetNode (n1k, SetEmpty, n1r, _) :: t1), (SetNode (n2k, SetEmpty, n2r, _) :: t2) -> 
               let c = comparer.Compare(n1k, n2k) 
               if c <> 0 then c else compareStacks comparer (n1r :: t1) (n2r :: t2)
          | (SetOne n1k :: t1), _ -> 
              compareStacks comparer (SetEmpty :: SetOne n1k :: t1) l2
          | (SetNode (n1k, n1l, n1r, _) :: t1), _ -> 
              compareStacks comparer (n1l :: SetNode (n1k, SetEmpty, n1r, 0) :: t1) l2
          | _, (SetOne n2k :: t2) -> 
              compareStacks comparer l1 (SetEmpty :: SetOne n2k :: t2)
          | _, (SetNode (n2k, n2l, n2r, _) :: t2) -> 
              compareStacks comparer l1 (n2l :: SetNode (n2k, SetEmpty, n2r, 0) :: t2)
  
      let compare comparer s1 s2 = 
          match s1, s2 with 
          | SetEmpty, SetEmpty -> 0
          | SetEmpty, _ -> -1
          | _, SetEmpty -> 1
          | _ -> compareStacks comparer [s1] [s2]
  
      let choose s =
          minimumElement s
  
      let toList s = 
          let rec loop m acc = 
              match m with 
              | SetNode (k, l, r, _) -> loop l (k :: loop r acc)
              | SetOne k ->  k :: acc
              | SetEmpty -> acc
          loop s []
  
      let copyToArray s (arr: _[]) i =
          let mutable j = i 
  
negative.code: 
  // A functional language implementation of binary trees
  
  [<NoEquality; NoComparison>]
  [<AllowNullLiteral>]
  type internal SetTree<'T>(k: 'T) =
      member _.Key = k
  
  [<NoEquality; NoComparison>]
  [<Sealed>]
  [<AllowNullLiteral>]
  type internal SetTreeNode<'T>(v:'T, left:SetTree<'T>, right: SetTree<'T>, h: int) =
      inherit SetTree<'T>(v)
  
      member _.Left = left
      member _.Right = right
      member _.Height = h
  
  [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
  module internal SetTree = 
      
      let empty = null
      
      let inline isEmpty (t:SetTree<'T>) = isNull t
  
      let rec countAux (t:SetTree<'T>) acc = 
          if isEmpty t then
              acc
          else
              match t with 
              | :? SetTreeNode<'T> as tn -> countAux tn.Left (countAux tn.Right (acc+1))
              | _ -> acc+1
  
      let count s = countAux s 0
  
  