Turbo Prolog's 'save' analogue in SWI-Prolog
-
12-11-2019 - |
Question
Is there any SWI's analogue for Turbo's save function, which saves into a file facts, previously loaded via consult and then appended via assert?
Solution
I've not found any save-like functions in manual. May be try the following replacement:
% Save whole DB into file
save(FileName) :-
open(FileName, update, F),
with_output_to(S, listing),
close(F).
Or even shorter:
save(FileName) :-
tell(FileName), listing, told.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow