reads a term from a stream and retrieves information about variables.
read_term/2 reads from the current inputstream a single term(Term).
read_term/3 reads from the given stream(Stream) a single
term(Term).
If the end of the stream is reached, Term will be unified with the
atom end_of_file.
Elements of the Options-list can be:
variables(-Vars)
variable_names(-VarList)
singletons(-VarList)
Stream text input stream Term term Options list of options
?- open('test.data', write, Stream),
write(Stream, 'member(X, [X|L]).\n'),
close(Stream).
?- open('test.data', read, Stream),
read_term(Stream, Term, [variable_names(VarNames),singletons(Singletons)]).
Term = member(_1, [_1|_2])
VarName = ['X' = _1, 'L' = _2]
Singletons = ['L' = _2]
These predicates are part of the ISO-Prolog Standard.