add consult/1 and shorthand for consult/1
% make '$compile_batch', a system routine, callable.
'$$compile_batch' :- '$compile_batch'.
-'$instruction_match'([user], []) :-
- !, catch('$$compile_batch', E, '$print_exception_with_check'(E)).
+'$instruction_match'([Item], []) :-
+ ( atom(Item) ->
+ ( Item == user ->
+ !,
+ catch('$$compile_batch', E, '$print_exception_with_check'(E))
+ ; consult(Item)
+ )
+ ; catch(throw(error(type_error(atom, Item), repl/0)),
+ '$print_exception_with_check'(E))
+ ).
'$instruction_match'(Term, VarList) :-
'$submit_query_and_print_results'(Term, VarList),
!.
; throw(error(instantiation_error, Source))
).
+consult(Item) :-
+ ( atom(Item) -> use_module(Item)
+ ; throw(error(type_error(atom, Item), consult/1))
+ ).
+
use_module(Module) :-
( nonvar(Module) ->
( Module = library(Filename) -> '$use_module'(Filename)
