anchor.diff:              // Return the final state value.
               state
   
  +    //
  +    member this.TryFindKey (predicate : int -> 'T -> bool) : int option =
  +        match this with
  +        | Empty ->
  +            None
  +        | Lf (k, x) ->
  +            if predicate (int k) x then
  +                Some (int k)
  +            else
  +                None
  +        | Br (_,_,_,_) as t ->
  +            let predicate = FSharpFunc<_,_,_>.Adapt predicate
  +
  +            // TODO : Run some experiments to determine if this is a good initial capacity,
  +            // or if there is a more suitable value.
  +            let stack = System.Collections.Generic.Stack (64)
  +
  +            // Add the initial tree to the stack.
  +            stack.Push t
  +
  +            /// Loop until we find a key/value that matches the predicate,
  +            /// or until we've processed the entire tree.
  +            let mutable matchingKey = None
  +            while stack.Count <> 0 && Option.isNone matchingKey do
  +                match stack.Pop () with
  +                | Empty -> ()
  +                | Lf (k, x) ->
  +                    if predicate.Invoke (int k, x) then
  +                        matchingKey <- Some (int k)
  +                    
  +                (* OPTIMIZATION :   When one or both children of this node are leaves,
  +                                    we handle them directly since it's a little faster. *)
  +                | Br (_, _, Lf (k, x), Lf (j, y)) ->
  +                    if predicate.Invoke (int k, x) then
  +                        matchingKey <- Some (int k)
  +                    elif predicate.Invoke (int j, y) then
  +                        matchingKey <- Some (int j)
  +                    
  +                | Br (_, _, Lf (k, x), right) ->
  +                    // Only handle the case where the left child is a leaf
  +                    // -- otherwise the traversal order would be altered.
  +                    if predicate.Invoke (int k, x) then
  +                        matchingKey <- Some (int k)
  +
  +                    stack.Push right
  +
  +                | Br (_, _, left, right) ->
  +                    // Push both children onto the stack and recurse to process them.
  +                    // NOTE : They're pushed in the opposite order we want to visit them!
  +                    stack.Push right
  +                    stack.Push left
  +
  +            // Return the matching key, if one was found.
  +            matchingKey
  +
  +    //
  +    member this.TryPick (picker : int -> 'T -> 'U option) : 'U option =
  +        match this with
  +        | Empty ->
  +            None
  +        | Lf (k, x) ->
  +            picker (int k) x
  +        | Br (_,_,_,_) as t ->
  +            let picker = FSharpFunc<_,_,_>.Adapt picker
  +
  +            // TODO : Run some experiments to determine if this is a good initial capacity,
  +            // or if there is a more suitable value.
  +            let stack = System.Collections.Generic.Stack (64)
  +
  +            // Add the initial tree to the stack.
  +            stack.Push t
  +
  +            /// Loop until we find a key/value that matches the picker,
  +            /// or until we've processed the entire tree.
  +            let mutable pickedValue = None
  +            while stack.Count <> 0 && Option.isNone pickedValue do
  +                match stack.Pop () with
  +                | Empty -> ()
  +                | Lf (k, x) ->
  +                    pickedValue <- picker.Invoke (int k, x)
  +                    
  +                (* OPTIMIZATION :   When one or both children of this node are leaves,
  +                                    we handle them directly since it's a little faster. *)
  +                | Br (_, _, Lf (k, x), Lf (j, y)) ->
  +                    pickedValue <-
  +                        match picker.Invoke (int k, x) with
  +                        | (Some _) as value ->
  +                            value
  +                        | None ->
  +                            picker.Invoke (int j, y)
  +                    
  +                | Br (_, _, Lf (k, x), right) ->
  +                    // Only handle the case where the left child is a leaf
  +                    // -- otherwise the traversal order would be altered.
  +                    pickedValue <- picker.Invoke (int k, x)
  +                    stack.Push right
  +
  +                | Br (_, _, left, right) ->
  +                    // Push both children onto the stack and recurse to process them.
  +                    // NOTE : They're pushed in the opposite order we want to visit them!
  +                    stack.Push right
  +                    stack.Push left
  +
  +            // Return the picked value.
  +            pickedValue
  +
  +    //
  +    member this.ToSeq () =
  +        seq {
  +        match this with
  +        | Empty -> ()
  +        | Lf (k, x) ->
  +            yield (int k, x)
  +        
  +        (* OPTIMIZATION :   When one or both children of this node are leaves,
  +                            we handle them directly since it's a little faster. *)
  +        | Br (_, _, Lf (k, x), Lf (j, y)) ->
  +            yield (int k, x)
  +            yield (int j, y)
  +                    
  +        | Br (_, _, Lf (k, x), right) ->
  +            // Only handle the case where the left child is a leaf
  +            // -- otherwise the traversal order would be altered.
  +            yield (int k, x)
  +            yield! right.ToSeq ()
  +
  +        | Br (_, _, left, right) ->
  +            // Recursively visit the children.
  +            yield! left.ToSeq ()
  +            yield! right.ToSeq ()
  +        }
   
   //
   [<Sealed>]
  
positive.code:     let inline lowestBit (x : int) : uint32 =
          uint32 (x &&& -x)
  
      // Returns the greatest power-of-two value contained within 'x'.
      let inline private highestBit (x, m) =
          // Zero all bits below m
          let x' = x &&& ~~~(m - 1u)
  
          let rec highb x =
              let m = lowestBit (int x)
              if x = m then m
              else highb (x - m)
  
          highb x'
  
      /// Finds the first bit at which p0 and p1 disagree.
      /// Returns a power-of-two value containing this (and only this) bit.
      let inline branchingBit (p0, p1) : uint32 =
          highestBit (p0 ^^^ p1, 1u)
  
  
      (* TODO :   Re-implement the 'highestBit' function using the Count Leading Zeros (clz) operation.
                  This should be significantly faster than our current implementation (or even Okasaki's
                  original implementation, since 'clz' can be implemented by just a few operations
                  (or a CPU intrinsic) using the algorithm based on de Bruijn sequences.
  
                  It may be possible to further optimize this code by replacing the table with
                  a 'match' (which would be compiled into a 'switch' IL OpCode). This change
                  won't be made until we can profile and confirm it's actually faster. *)
      (*
  
      //
      let internal deBruijnBitPosition = [|
          0u; 9u; 1u; 10u; 13u; 21u; 2u; 29u; 11u; 14u; 16u; 18u; 22u; 25u; 3u; 30u;
          8u; 12u; 20u; 28u; 15u; 17u; 24u; 7u; 19u; 27u; 23u; 6u; 26u; 5u; 4u; 31u; |]
  
      /// Rounds a 32-bit integer down to one less
      /// than the next-lowest power-of-two.
      let inline private roundDown32 (v : uint32) =
          assert (v >= GenericZero)
          let v = v ||| (v >>> 1)
          let v = v ||| (v >>> 2)
          let v = v ||| (v >>> 4)
          let v = v ||| (v >>> 8)
          let v = v ||| (v >>> 16)
          v
  
      /// Computes the index of the de Bruijn sequence.
      let inline private deBruijnArrayIndex (v : uint32) : uint32 =
          ((roundDown32 v) * 0x07C4ACDDu) >>> 27
  
      /// Computes the base-2 logarithm (log_2) of a 32-bit integer.
      let inline private int32Log2 (v : uint32) : uint32 =
          deBruijnBitPosition.[int <| deBruijnArrayIndex v]
  
      /// Count Leading Zeros (clz).
      let inline private countLeadingZeros (x : uint32) : uint32 =
          if x = 0u then 32u
          else
              32u - (int32Log2 x)
  
      /// Finds the first bit at which p0 and p1 disagree.
      let branchingBit' (p0, p1) : uint32 =
          match p0 ^^^ p1 with
          | 0u -> 0u
          | x ->
              1u <<< (int <| int32Log2 x)
      *)
  
  
  open BitOps
  
negative.code: 
      //
      static member (*inline*) private Join (p0, t0 : PatriciaMap<'T>, p1, t1) =
          let m = branchingBit (p0, p1)
          let p = mask (p0, m)
          if zeroBit (p0, m) then
              Br (p, m, t0, t1)
  