Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on_x_rtrace(C):-
- catch(C,E,
- (writeln(E),visible(+all), leash(-all),leash(+exception),C)).
- %% File handling code for prolog
- save_to_file(File_name, Term) :- %Term should be an instantiated list
- open(File_name, write, Data),
- set_stream(Data,representation_errors(prolog)),
- % set_stream(Data,encoding(utf8)),
- write_results_to_file(Data, Term),
- close(Data).
- % write to file stream. Saves only the most recently asserted results.
- write_results_to_file(Stream, [H|Rest]) :-
- on_x_rtrace(write(Stream, H)),
- write(Stream, "\n"),
- write_results_to_file(Stream, Rest).
- write_results_to_file(Stream, []) :-
- write(Stream, "\n"), !.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement