anchor.diff:  vars_in_struct(Str, I, S, Vs) ->
       vars_in_struct(Str, I+1, S, vars_in(element(I, Str), Vs)).
   
  -%% consult_file(File, Database) ->
  -%%	{ok,NewDatabase} | {error,Error} | {erlog_error,Error}.
  -%% reconsult_file(File, Database) ->
  -%%	{ok,NewDatabase} | {error,Error} | {erlog_error,Error}.
  -%% Load/reload an Erlog file into the interpreter. Reloading will
  -%% abolish old definitons of clauses.
  -
  -consult_file(File, Db0) ->
  -    case erlog_io:read_file(File) of
  -	{ok,Terms} ->
  -	    consult_terms(fun consult_assert/2, Db0, Terms);
  -	Error -> Error
  -    end.
  -
  -consult_assert(Term0, Db) ->
  -    Term1 = erlog_int:expand_term(Term0),
  -    {ok,erlog_int:assertz_clause(Term1, Db)}.
  -
  -reconsult_file(File, Db0) ->
  -    case erlog_io:read_file(File) of
  -	{ok,Terms} ->
  -	    case consult_terms(fun reconsult_assert/2, {Db0,[]}, Terms) of
  -		{ok,{Db1,_Seen1}} -> {ok,Db1};
  -		Error -> Error
  -	    end;
  -	Error -> Error
  -    end.
  -
  -reconsult_assert(Term0, {Db0,Seen}) ->
  -    Term1 = erlog_int:expand_term(Term0),
  -    Func = functor(Term1),
  -    case lists:member(Func, Seen) of
  -	true ->
  -	    {ok,{erlog_int:assertz_clause(Term1, Db0), Seen}};
  -	false ->
  -	    Db1 = erlog_int:abolish_clauses(Func, Db0),
  -	    {ok,{erlog_int:assertz_clause(Term1, Db1), [Func|Seen]}}
  -    end.
  -
  -%% consult_terms(InsertFun, Database, Terms) ->
  -%%      {ok,NewDatabase} | {erlog_error,Error}.
  -%% Add terms to the database using InsertFun. Ignore directives and
  -%% queries.
  -
  -consult_terms(Ifun, Db, [{':-',_}|Ts]) ->
  -    consult_terms(Ifun, Db, Ts);
  -consult_terms(Ifun, Db, [{'?-',_}|Ts]) ->
  -    consult_terms(Ifun, Db, Ts);
  -consult_terms(Ifun, Db0, [T|Ts]) ->
  -    case catch Ifun(T, Db0) of
  -	{ok,Db1} -> consult_terms(Ifun, Db1, Ts);
  -	{erlog_error,E,_Db1} -> {erlog_error,E};
  -	{erlog_error,E} -> {erlog_error,E}
  -    end;
  -consult_terms(_Ifun, Db, []) -> {ok,Db}.
  -
  -functor({':-',H,_B}) -> erlog_int:functor(H);
  -functor(T) -> erlog_int:functor(T).
  -
  -%% The old is_constant/1 ?
  --define(IS_CONSTANT(T), (not (is_tuple(T) orelse is_list(T)))).
  -
   %% is_legal_term(Goal) -> true | false.
   %% Test if a goal is a legal Erlog term. Basically just check if
   %% tuples are used correctly as structures and variables.
  
positive.code: -export([start/0,start_link/0]).
  -export([prove/2,next_solution/1,
  	 consult/2,reconsult/2,get_db/1,set_db/2,halt/1]).
  %% User utilities.
  -export([is_legal_term/1,vars_in/1]).
  -export([consult_file/2,reconsult_file/2]).
  
  -import(lists, [foldl/3,foreach/2]).
  
  %% -compile(export_all).
  
  new() ->
      Db0 = erlog_int:built_in_db(),		%Basic interpreter predicates
      Db1 = erlog_bips:assert(Db0),		%Built in predicates
      fun (Cmd) -> top_cmd(Cmd, Db1) end.
  
  top_cmd({prove,Goal}, Db) ->
  
negative.code: %% names like '$1' (yuch!), and we need LOTS of variables.
  
  -module(erlog).
  
  -include("erlog_int.hrl").
  
  %% Basic evaluator interface.
  -export([new/0]).
  