anchor.diff:              end
       end.
   
  +
  +
  +%% @doc Determines whether the passed term is a set container.
   is_type(T) ->
       is_record(T, floppy_set).
   
  +
  +%% @doc Returns the symbolic name of this container.
   type() -> riak_dt_orset.
   
  -to_ops(#floppy_set{key=Key, adds=Adds, rems=Rems}=Ops) -> 
  -    io:format("to ops ~p ~n",[Ops]),
  +to_ops(#floppy_set{key=Key, adds=Adds, rems=Rems}) -> 
       case sets:size(Adds) =:= 0 andalso sets:size(Rems) =:= 0 of
           true -> undefined;
  -        false -> 
  -            [#fpbsetupdatereq{key=Key, adds=sets:to_list(Adds), rems=sets:to_list(Rems)}]
  +        false ->
  +            AddsAsBin = lists:map(fun(X) ->
  +                                          erlang:term_to_binary(X)
  +                                  end,sets:to_list(Adds)),
  +            RemsAsBin = lists:map(fun(X) ->
  +                                          erlang:term_to_binary(X)
  +                                  end,sets:to_list(Rems)),
  +            [#fpbsetupdatereq{key=Key, adds=AddsAsBin, rems=RemsAsBin}]
       end.
   
   message_for_get(Key) -> #fpbgetsetreq{key=Key}.
  
positive.code:             end
      end.
  
  %% @doc Checks if the set contains the given element.
  contains(Elem, #floppy_set{set=Set, adds=Adds, rems=Rems}) ->
      case sets:is_element(Elem, Adds) of
          true -> true;
  
negative.code: 
  new(Key, [_H | _] = List) ->
      Set = lists:foldl(fun(E,S) ->
                          sets:add_element(E,S)
                  end,sets:new(),List),
      #floppy_set{key=Key, set=Set, adds=sets:new(), rems=sets:new()};
  
  
  new(Key, Set) ->
      #floppy_set{key=Key, set=Set, adds=sets:new(), rems=sets:new()}.
  
  -spec value(floppy_set()) -> set().
  value(#floppy_set{set=Set}) -> Set.
  
  -spec dirty_value(floppy_set()) -> set().
  dirty_value(#floppy_set{set=Set, adds=Adds}) ->
      sets:union(Set,Adds).
  
  %% @doc Adds an element to the local set.
  add(Elem, #floppy_set{set=Set, adds=Adds}=Fset) ->
       case sets:is_element(Elem, Set) of
          false -> Fset#floppy_set{adds=sets:add_element(Elem,Adds)};
          true -> Fset
       end.
  
  remove(Elem, #floppy_set{set=Set, adds=Adds, rems=Rems}=Fset) ->
      case sets:is_element(Elem, Adds) of
          true ->  Fset#floppy_set{adds=sets:del_element(Elem,Adds)};
  