anchor.diff:  
           CharDiet.forall predicate charSet.Tree
   
  -    //
  +    /// Applies the given accumulating function to all elements in a DIET.
       static member Fold (folder : 'State -> _ -> 'State, state, charSet : CharSet) : 'State =
           // Preconditions
           checkNonNull "charSet" charSet
   
           CharDiet.fold folder state charSet.Tree
   
  -    //
  +    /// Applies the given accumulating function to all elements in a DIET.
       static member FoldBack (folder : _ -> 'State -> 'State, state, charSet : CharSet) : 'State =
           // Preconditions
           checkNonNull "charSet" charSet
  
positive.code:             #endif
              result
  
      /// Helper function for computing the intersection of two sets.
      let rec private inter' (input : CharDiet) head (stream : CharDiet) : CharDiet * (char * char) option * CharDiet =
          match head, input with
          | None, _ ->
              Empty, None, Empty
          | _, Empty ->
              Empty, head, stream
          | Some (x, y), Node (left, right, (a, b), _) ->
              let left, head, stream =
                  if x < a then
                      inter' left head stream
                  else
                      Empty, head, stream
  
              inter_helper (a, b) right left head stream
  
      /// Helper function for computing the intersection of two sets.
      and private inter_helper (a, b) (right : CharDiet) (left : CharDiet) head stream =
          match head with
          | None ->
              left, None, Empty
          | Some (x, y) ->
              if y < a then
                  match stream with
                  | Empty ->
                      left, None, Empty
                  | _ ->
                      let head, stream = AvlTree.ExtractMin stream
                      inter_helper (a, b) right left (Some head) stream
              elif b < x then
                  let right, head, stream = inter' right head stream
                  AvlTree.Reroot (comparer, left, right), head, stream
              elif y >= clampedPred y b then
                  let right, head, stream = inter' right head stream
                  let right' = AvlTree.Join (comparer, left, right, (max x a, min y b))
                  right', head, stream
              else
                  let left = addRange (max x a, y) left
                  inter_helper (succ y, b) right left head stream
  
      /// Computes the intersection of the two sets.
      let rec intersect (input : CharDiet) (stream : CharDiet) : CharDiet =
          if AvlTree.Height stream > AvlTree.Height input then
              intersect stream input
          else
          match stream with
          | Empty -> Empty
          | _ ->
              #if DEBUG
              let inputCount = count input
              let streamCount = count stream
              /// The minimum possible number of elements in the resulting set.
              let minPossibleResultCount =
                  min inputCount streamCount
              /// The maximum possible number of elements in the resulting set.
              let maxPossibleResultCount =
                  inputCount + streamCount
              #endif
  
              let result, _, _ =
                  let head, stream = AvlTree.ExtractMin stream
                  inter' input (Some head) stream
  
              #if DEBUG
              let resultCount = count result
  //            let inputArr =
  //                if resultCount >= minPossibleResultCount then Array.empty
  //                else toArray input
  //            let streamArr =
  //                if resultCount >= minPossibleResultCount then Array.empty
  //                else toArray stream
                      
              Debug.Assert (
                  resultCount >= minPossibleResultCount,
                  sprintf "The result set should not contain fewer than %i elements, but it contains only %i elements."
                      minPossibleResultCount resultCount)
              Debug.Assert (
                  resultCount <= maxPossibleResultCount,
                  sprintf "The result set should not contain more than %i elements, but it contains %i elements."
                      maxPossibleResultCount resultCount)
              #endif
              result
  
      /// Helper function for computing the difference of two sets.
      let rec private diff' (input : CharDiet) head (stream : CharDiet) : CharDiet * (char * char) option * CharDiet =
          match head, input with
          | None, _->
              input, None, Empty
  
negative.code:                     if b <= y then y, right
                      else find_del_right b right
  
                  assert (AvlTree.AvlInvariant left')
                  assert (AvlTree.AvlInvariant right')
                  AvlTree.Join (comparer, left', right', (x', y'))
  
      /// Returns a new set with the given element removed.
      /// No exception is thrown if the set doesn't contain the specified element.
      let rec remove value (tree : CharDiet) : CharDiet =
          // Preconditions
          assert (AvlTree.AvlInvariant tree)
  
          match tree with
          | Empty ->
              Empty
  