write_list_goal(@stream_or_alias, ?list_of_terms, +body_term)

This built-in predicate outputs a list of terms to an output stream. The output stream must be a text stream that was opened for writing or appending data. See write/2 for information about how the terms are written to the stream. The third parameter is called to seperate each item in the list, i.e. after writing the first element in the list the body_term is called, then again after the second, etc., but not after the last element in the list.

see also: char_conversion/2 current_char_conversion/2 current_op/3 op/3 read/1 read/2 read_term/2 read_term/3 write/1 write/2 write_canonical/1 write_canonical/2 write_list/1 write_list/2 write_list_goal/2 write_term/2 write_term/3 writeq/1 writeq/2

Example
write_list_goal(user_out, ['Value:' , X], nl). succeeds and writes the text 'Value:' to the stream 'user_out', then a newline character is written because nl/0 is called and then the value of X was written to the same stream

 

Exceptions  
the output stream is associated with a binary stream a permission_error(output, binary_stream, OS) is thrown and OS is substituted by the binary stream
the body_term argument is an empty variable an instantiation_error exception is thrown

 

 

info@trinc-prolog.com