Consulting file

Description

Consulting a file

Source: The Art of Prolog

Download

Program source code: consulting_file.pl

Listing

/*
 
    consult_(File) :- 
 
	The clauses of the program in the file File are read and asserted.
 
*/
 
 
 
	consult_(File) :- open(File,read,DD), consult_loop(DD), close(DD).
 
 
 
	consult_loop(DD) :- repeat, read(Clause), process(Clause,DD)), !.
 
 
 
	process(Clause,DD) :- at_end_of_stream(DD).
 
	process(Clause,DD) :- assertz(Clause), fail.
 
 
 
%  Program 12.9:    Consulting a 
file

Comments

RTERR: /prolog-pllib-consulting_file.pl:6:8: Syntax error: Illegal start of term

pl/prolog/pllib/consulting_file.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0