PLOGHELP WRITE Chris Mellish, August 1982 Revised by Robert Duncan, August 1989 Predicates which write a term to the current output. ?- write(Term). ?- vwrite(Term, Env). Both of these predicates write Term to the current output stream, taking account of any current operator declarations. Uninstantiated variables in Term are written as an underscore ("_") followed by a number: the numbers are not significant except that in any single call of 'write' or 'vwrite', variables printed with the same number are guaranteed to be sharing. Example: ?- write('Solution: '), write(sqrt(X) + 1), nl. Solution: sqrt(_1) + 1 X = _1 ? yes The second argument to 'vwrite/2' is an environment such as that returned by 'vread/2' (see PLOGHELP * READ) which associates variables with atomic names: any uninstantiated variable which occurs in Term and which has an entry in Env is written out as the corresponding atom. Example: ?- write('Solution: '), vwrite(sqrt(X) + 1, ['X' = X]), nl. Solution: sqrt(X) + 1 X = _1 ? yes Note: 'write/2' is available as a a synonym for 'vwrite/2', for compatibility with other Prolog systems. -- RELATED DOCUMENTATION ---------------------------------------------- PLOGHELP * I_O Overview of input/output operations in Prolog PLOGHELP * PRINT Predicate which prints argument to current output. PLOGHELP * PORTRAY Predicate which changes the action of the 'print' predicate. PLOGHELP * DISPLAY Predicate which writes argument to current output in prefix format PLOGHELP * WRITEQ Special form of 'write' predicate. Puts atom quotes around atoms which need them. --- C.all/plog/help/write --- Copyright University of Sussex 1989. All rights reserved. ----------