anchor.diff:      ORSet.
   
   % -spec merge(orset(), orset()) -> orset().
  -% merge(ORDictA, ORDictB) ->
  -%     orddict:merge(fun(_Elem,TokensA,TokensB) ->
  -%             orddict:merge(fun(_Token,BoolA,BoolB) ->
  -%                     BoolA or BoolB
  -%                 end, TokensA, TokensB)
  -%         end, ORDictA, ORDictB).
  -
  -% -spec equal(orset(), orset()) -> boolean().
  -% equal(ORDictA, ORDictB) ->
  -%     ORDictA == ORDictB. % Everything inside is ordered, so this should work
  +merge(ORSet1, ORSet2) ->
  +    MergeFun = fun(TokensA, TokensB) ->
  +            orddict:merge(fun(_Token, BoolA, BoolB) ->
  +                BoolA or BoolB
  +            end, TokensA, TokensB)
  +    end,
  +    gb_trees_ext:merge(ORSet1, ORSet2, MergeFun).
  +
  +-spec equal(orset(), orset()) -> boolean().
  +equal(ORDictA, ORDictB) ->
  +    gb_trees_ext:equal(ORDictA, ORDictB).
   
   %% @doc the precondition context is a fragment of the CRDT that
   %% operations with pre-conditions can be applied too.  In the case of
  
positive.code:         true ->
              Tokens = gb_trees:get(Elem, ORSet),
              Tokens1 = orddict:store(Token, false, Tokens),
              {ok, orddict:store(Elem, Tokens1, ORSet)};
          false ->
              Tokens = orddict:store(Token, false, orddict:new()),
              {ok, gb_trees:enter(Elem, Tokens, ORSet)}
  
negative.code:         false ->
              orddict:new()
      end;
  value(removed, ORSet) ->
      gb_trees_ext:fold(fun(Elem, Tokens, Acc0) ->
                  case length(removed_tokens(Tokens)) > 0 of
                      true ->
                          Acc0 ++ [Elem];
                      false ->
                          Acc0
                  end
          end, [], ORSet);
  value(_,ORSet) ->
      value(ORSet).
  
  -spec update(orset_op(), actor(), orset()) ->
      {ok, orset()} | {error, {precondition, {not_present, member()}}}.
  