anchor.diff:      #scarcity{counters=Counters, ordering=Ordering} = Scarcity,
       assert_member(Index, Counters),
   
  -    Count = array:get(Index, Counters),
  -    NewCounters = array:set(Index, Count - 1, Counters),
  +    Count    = array:get(Index, Counters),
  +    NewCount = Count - 1,
  +    assert_positive(NewCount),
  +    NewCounters = array:set(Index, NewCount, Counters),
       TmpOrdering = gb_sets:delete({Count, Index}, Ordering),
  -    NewOrdering = gb_sets:insert({Count - 1, Index}, TmpOrdering),
  +    NewOrdering = gb_sets:insert({NewCount, Index}, TmpOrdering),
   
       #scarcity{counters=NewCounters, ordering=NewOrdering}.
   
  
positive.code:     
  
  %% @doc
  %%
  %% @end
  -spec from_list(list({pos_integer(), pos_integer()})) -> scarcity().
  from_list(ScarcityList) ->
      InitCounters = array:from_orddict(ScarcityList),
      InitOrdering = gb_sets:from_list([{S,I} || {I,S} <- ScarcityList]),
      #scarcity{counters=InitCounters, ordering=InitOrdering}.
  
  %% @doc
  %%
  %% @end
  -spec to_list(#scarcity{}) -> list(pos_integer()).
  to_list(Scarcity) ->
  
negative.code:     end.
  
  
  %% @doc
  %%
  %% @end
  -spec assert_positive(pos_integer()) -> ok.
  assert_positive(Integer) ->
      case Integer < 0 of
          false ->
              ok;
          true ->
              error(badarg)
      end.
  
  
  -ifdef(TEST).
  -define(mod, ?MODULE).
  
  