anchor.diff:  
   decode_avps(Name, Recs) ->
       {Avps, {Rec, Failed}}
  -        = lists:foldl(fun(T,A) -> decode(Name, T, A) end,
  -                      {[], {newrec(Name), []}},
  +        = mapfoldl(fun(T,A) -> decode(Name, T, A) end,
  +                      {newrec(Name), []},
                         Recs),
       {Rec, Avps, Failed ++ missing(Rec, Name, Failed)}.
   %% Append 5005 errors so that errors are reported in the order
  
positive.code: %% g/4
  
  g({RC, ErrorData}, Avp, Acc, ComponentAvps) ->
      {Avps, {Rec, Errors}} = Acc,
      E = Avp#diameter_avp{data = [ErrorData]},
      {[[Avp | trim(ComponentAvps)] | Avps], {Rec, [{RC, E} | Errors]}}.
  
  %% d/5
  
  
negative.code: 
  newrec(Name) ->
      '#new-'(name2rec(Name)).
  
  %% mapfoldl/3
  %%
  %% Like lists:mapfoldl/3, but don't reverse the list.
  
  mapfoldl(F, Acc, List) ->
      mapfoldl(F, Acc, List, []).
  
  mapfoldl(F, Acc0, [T|Rest], List) ->
      {B, Acc} = F(T, Acc0),
      mapfoldl(F, Acc, Rest, [B|List]);
  mapfoldl(_, Acc, [], List) ->
      {List, Acc}.
  
  %% 3588:
  %%
  