prologsaveswi-prologfactturbo-prolog

Turbo Prolog's 'save' analogue in SWI-Prolog


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.