anchor.diff:      end.
   
   get_gbinding(N, A, #env{funs=Fs}) ->
  -    case orddict:find(N, Fs) of
  +    case ?FIND(N, Fs) of
           {ok,{function,Fas}} ->
               case lists:keyfind(A, 1, Fas) of
                   false -> get_guard_bif(N, A);
  
positive.code:                   {function,lists:keystore(A, 1, Fas, T)};
                (_) -> Def                        %Overwrite macros
            end,
      orddict:update(N, Upd, Def, Fs).
  
  add_fbindings(Fbs, #env{funs=Fs0}=Env) ->
      Fs1 = foldl(fun ({N,A,V}, Fs) -> add_fbinding_1(N, A, {A,V}, Fs) end,
  
negative.code: %%  is no longer a legal guard bif but must be explicitly called with
  %%  module erlang.
  
  new() -> #env{vars=?NEW(),funs=?NEW()}. 
  
  -ifdef(HAS_MAPS).
  add_env(#env{vars=Vs1,funs=Fs1}, #env{vars=Vs2,funs=Fs2}) ->
      #env{vars=maps:merge(Vs2, Vs1),             %Always take left env
           funs=maps:merge(Fs2, Fs1)}.
  -else.
  add_env(#env{vars=Vs1,funs=Fs1}, #env{vars=Vs2,funs=Fs2}) ->
      Merge = fun (_, V1, _) -> V1 end,           %Always take left env
      #env{vars=orddict:merge(Merge, Vs1, Vs2),
           funs=orddict:merge(Merge, Fs1, Fs2)}.
  -endif.
  
  get_vars(Env) -> Env#env.vars.
  clr_vars(Env) -> Env#env{vars=?NEW()}.
  set_vars(Vars, Env) -> Env#env{vars=Vars}.
  fold_vars(Fun, Acc, Env) ->
      ?FOLD(Fun, Acc, Env#env.vars).
  
  get_funs(Env) -> Env#env.funs.
  clr_funs(Env) -> Env#env{funs=?NEW()}.
  set_funs(Funs, Env) -> Env#env{funs=Funs}.
  
  fold_funs(Fun, Acc, Env) ->
      Ofun = fun (F, {function,Fs}, Ac) ->        %Function
                     Ffun = fun ({Ar,Def}, A) ->
                                    Fun(F, Ar, Def, A)
                            end,
                     lists:foldl(Ffun, Ac, Fs);
                 (_, _, A) -> A                   %Macro
             end,
      ?FOLD(Ofun, Acc, Env#env.funs).
  
  fold_macros(Fun, Acc, Env) ->
      Ofun = fun (F, {macro,Def}, A) ->           %Macro
                     Fun(F, Def, A);
                 (_, _, A) -> A                   %Function
             end,
      ?FOLD(Ofun, Acc, Env#env.funs).
  
  %% Variables.
  
  add_vbinding(N, V, #env{vars=Vs}=Env) ->
      Env#env{vars=?PUT(N, V, Vs)}.
  
  add_vbindings(Vbs, #env{vars=Vs0}=Env) ->
      Vs1 = foldl(fun ({N,V}, Vs) -> ?PUT(N, V, Vs) end, Vs0, Vbs),
      Env#env{vars=Vs1}.
  
  is_vbound(N, #env{vars=Vs}) ->
      ?IS_KEY(N, Vs).
  
  get_vbinding(N, #env{vars=Vs}) ->
      case ?FIND(N, Vs) of
          {ok,V} -> {yes,V};
          error -> no
      end.
  
  fetch_vbinding(N, #env{vars=Vs}) ->
      ?GET(N, Vs).
  
  del_vbinding(N, #env{vars=Vs}=Env) ->
      Env#env{vars=?ERASE(N, Vs)}.
  
  %% Functions.
  
  