anchor.diff:  %% Author  : Robert Virding
   %% Purpose : A simple Lisp Flavoured Erlang shell.
   
  +%% We keep two environments, the BaseEnv which contains the predefined
  +%% shell variables and shell macros, and a current environment. The
  +%% BaseEnv is used when we need to revert to an "empty" environment.
  +%% When we slurp in a file the functions are stored in the BaseEnv and
  +%% the current environment is thrown away.
  +
   -module(lfe_shell).
   
   -export([start/0,start/1,server/0,server/1]).
  
positive.code: 
  -record(slurp, {mod,imps=[]}).			%For slurping
  
  slurp([File], Eenv, Benv) ->
      Name = lfe_eval:expr(File, Eenv),		%Get file name
      case slurp_file(Name) of			%Parse, expand and lint file
  	{ok,Fs,Fenv0,_} ->
  	    St0 = #slurp{mod='-no-mod-',imps=[]},
  	    {Fbs,St1} = lfe_lib:proc_forms(fun collect_form/3, Fs, St0),
  	    %% Add imports to environment.
  	    Fenv1 = foldl(fun ({M,Is}, Env) ->
  				  foldl(fun ({{F,A},R}, E) ->
  						add_ibinding(M, F, A, R, E)
  					end, Env, Is)
  			  end, Fenv0, St1#slurp.imps),
  	    %% Get a new environment with all functions defined.
  	    Fenv2 = lfe_eval:make_letrec_env(Fbs, Fenv1),
  	    {yes,{ok,St1#slurp.mod},add_env(Fenv2, Benv)};
  	{error,Es,_} ->
  	    slurp_errors(Name, Es),
  	    {yes,error,Benv}
      end;
  slurp(_, _, _) -> no.
  
  slurp_file(Name) ->
      %% Parse, expand macros and lint file.
  
negative.code: 	error -> Def
      end.
  
  %% (defmacro safe_fetch (key d def)
  %%   `(case (find ,key ,d)
  %%      ((tuple 'ok val) val)
  %%      ('error ,def)))
  