projog

3.93. Read clauses and goals from a list of files.

Examples

write_to_file(Filename, Contents) :-
open(Filename, write, Z),
set_output(Z),
writef(Contents),
close(Z),
set_output('user_output').

?- write_to_file('consult_list_example_1.tmp', 'test1.').

yes

?- write_to_file('consult_list_example_2.tmp', 'test2.').

yes

?- write_to_file('consult_list_example_3.tmp', 'test3.').

yes

?- write_to_file('consult_list_example_4.tmp', 'test4.').

yes

?- write_to_file('consult_list_example_5.tmp', 'test5.').

yes

?- write_to_file('consult_list_example_6.tmp', 'test6.').

yes

?- test1.

no

?- ['consult_list_example_1.tmp'].

yes

?- test1.

yes

?- test2.

no

?- test3.

no

?- ['consult_list_example_2.tmp', 'consult_list_example_3.tmp'].

yes

?- test2, test3.

yes

?- test4.

no

?- test5.

no

?- test6.

no

?- ['consult_list_example_4.tmp', 'consult_list_example_5.tmp', 'consult_list_example_6.tmp'].

yes

?- test4, test5, test6.

yes