anchor.diff:      ok.
   
   delta_check(Before, After, _ExpectGrows, _ExpectShrinks) ->
  -    {Grows, _Shrinks} = delta(Before, After),
  -    ?debugVal(Before),
  -    ?debugVal(After),
  +    {_Grows, _Shrinks} = delta(Before, After),
  +%    ?debugVal("------"),
  +%    ?debugVal(Before),
  +%    ?debugVal(After),
       % ?debugVal(ExpectGrows),
  -    ?debugVal(Grows),
  +%    ?debugVal(Grows),
  +%    ?debugVal(Shrinks),
       % ?assertEqual(ExpectGrows, Grows),
       % ?assertEqual(ExpectShrinks, Shrinks),
       ok.
  
positive.code:     if B =:= max -> delta(BPrev, BList,
                            A, ARest,
                            BAFull,
                            [{A, APrev, delta_next(BList, Before)} | Grows],
                            Shrinks);
         A =:= max -> delta(B, BRest,
                            APrev, AList,
                            BAFull,
                            [{B, BPrev, delta_next(AList, After)} | Grows],
                            Shrinks);
         B < A     -> delta(B, BRest,
                            APrev, AList,
                            BAFull,
                            [{B, BPrev, delta_next(AList, After)} | Grows],
                            Shrinks);
         true      -> delta(BPrev, BList,
                            A, ARest,
                            BAFull,
                            [{A, APrev, delta_next(BList, Before)} | Grows],
                            Shrinks)
      end.
  
  delta_next([], [])      -> undefined;
  delta_next([A | _], _)  -> A;
  delta_next([], Restart) -> delta_next(Restart, []).
  
negative.code: % Returns [{Addr, Data}*], where length of result might be <= N.
  
  search_by_point(#cring{ring = Ring, addr_num = AddrNum}, SearchPoint, N) ->
      carcs_addr_data(
        search_ring_by_point(Ring, SearchPoint, Ring, erlang:min(AddrNum, N))).
  
  %% Implementation
  
  carcs_addr_data(CArcs) ->
      lists:map(fun (#carc{addr = Addr, data = Data}) -> {Addr, Data} end,
                CArcs).
  
  make(_Hash, [], CArcs) ->
      % TODO: Consider secondary sort on hash_ord to reduce (but not
      % eliminate) unlucky case when there's a hash collision.
      lists:keysort(#carc.pt_end, CArcs);
  
  make({HashMod, HashCfg} = Hash, [{Addr, Data} | Rest], Acc) ->
      Points = HashMod:hash_addr(Addr, HashCfg),
      {_, _, Acc2} =
          lists:foldl(
            fun (Point, {N, PointPrev, AccMore}) ->
                {N + 1, Point, [#carc{pt_beg = PointPrev,
                                      pt_end = Point,
                                      hash_ord = N,
                                      addr = Addr,
                                      data = Data} | AccMore]}
            end,
            {1, min, Acc},
            Points),
      make(Hash, Rest, Acc2).
  
  % Returns [CArc*], where length might be <= TakeN.
  
  search_ring_by_point([], _SearchPoint, Ring, TakeN) ->
      util:take_ring_n(fun carc_not_member_by_addr/2,
                       Ring, TakeN, undefined);
  
  search_ring_by_point([#carc{pt_end = Point} | Rest] = CArcs,
                       SearchPoint, Ring, TakeN) ->
      % TODO: Do better than linear search.
      % For example, use erlang array instead of list.
      case SearchPoint =< Point of
          true  -> util:take_ring_n(fun carc_not_member_by_addr/2,
                                    CArcs, TakeN, Ring);
          false -> search_ring_by_point(Rest, SearchPoint, Ring, TakeN)
      end.
  
  carc_not_member_by_addr(#carc{addr = Addr}, CArcs) ->
      case lists:keysearch(Addr, #carc.addr, CArcs) of
          {value, _} -> false;
          false      -> true
      end.
  
  % Example hash_key/hash_addr functions.
  
  