:- module(input,[load_file/1,my_clause/2]).

:- dynamic my_clause/2.

load_file(F) :-
    retractall(my_clause(_,_)),
	see(F),
	remember_all,
	seen.

remember_all :-
	read(C),
	(
	    C == end_of_file -> true
	;
	    remember_clause(C),
	    remember_all
	).

remember_clause((A :- B)) :-
	!,
	tuple2list(B,BL),
	assert(my_clause(A,BL)).

remember_clause(A) :-
	assert(my_clause(A,[])).

tuple2list((A,As),[A|LAs]) :-
	!,
	tuple2list(As,LAs).
tuple2list(A,[A]).

