PLOGHELP READ Chris Mellish, August 1982 Revised by Robert Duncan, August 1989 Predicates which read terms from the current input. ?- read(Term). ?- vread(Term, Env). Both of these predicates unify Term with a term read from the current input stream. Input is interpreted using the Dec10 Prolog 'LC' convention (words starting with upper case letters denote variables) and must be terminated with ".". Term is unified with the atom 'end_of_file' if the input stream is at end of file. Example: ?- read(Term). |: p(q(X), Y). Term = p(q(_1), _2) ? yes 'vread/2' also unifies Env with an environment associating variables in Term with the names under which they occurred in the input. The environment is a list of entries of the form: Name = Var Example: ?- vread(Term, Env). |: p(q(X), Y). Term = p(q(_1), _2) Env = [Y = _2, X = _1] ? yes The prompt used by 'read' and 'vread' can be changed with the predicate 'prompt/2' (see PLOGHELP * PROMPT). Note: 'read/2' is available as a a synonym for 'vread/2', for compatibility with other Prolog systems. -- RELATED DOCUMENTATION ---------------------------------------------- PLOGHELP * I_O Overview of input/output operations in Prolog --- C.all/plog/help/read --- Copyright University of Sussex 1989. All rights reserved. ----------