anchor.diff:  -spec to_list(#scarcity{}) -> list(pos_integer()).
   to_list(Scarcity) ->
       #scarcity{ordering=Ordering} = Scarcity,
  -    Ordering.
  +    [Index || {_, Index} <- gb_sets:to_list(Ordering)].
   
   
   %% @doc
  
positive.code: %% @end
  -spec increment(pos_integer(), #scarcity{}) -> scarcity().
  increment(Index, Scarcity) ->
      #scarcity{
          members=Members,
          counters=Counters,
          ordering=Ordering} = Scarcity,
      assert_member(Index, Members),
  
      PrevCount = array:get(Index, Counters),
      NewCounters = array:set(Index, PrevCount + 1, Counters),
      NewOrdering = reorder(Index, NewCounters, Ordering),
  
      NewScarcity = #scarcity{
          counters=NewCounters,
          ordering=NewOrdering},
      NewScarcity.
  
  
  %% @doc
  
negative.code: %% @end
  -spec insert(pos_integer(), pos_integer(), #scarcity{}) -> scarcity().
  insert(Index, Count, Scarcity) ->
      #scarcity{counters=Counters, ordering=Ordering} = Scarcity,
      assert_not_member(Index, Counters),
  
      NewCounters = array:set(Index, Count, Counters),
      NewOrdering = gb_sets:insert({Count, Index}, Ordering),
  
      #scarcity{counters=NewCounters, ordering=NewOrdering}.
  
  %% @doc
  %%
  %% @end
  -spec delete(pos_integer(), #scarcity{}) -> scarcity().
  delete(Index, Scarcity) ->
      #scarcity{counters=Counters, ordering=Ordering} = Scarcity,
      assert_member(Index, Counters),
  
      Count = array:get(Index, Counters),
      NewCounters = array:reset(Index, Counters),
      NewOrdering = gb_sets:delete({Count, Index}, Ordering),
  
      #scarcity{counters=NewCounters, ordering=NewOrdering}.
  
     
  
  