Re: listing/1 behavior

Lindsey Spratt <[email protected]>
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
This issue came up on this list just recently ("Bug with streams or 
listing?"). I answered it with the following:

The problem here is that listing/1 does not write to stdout (which is 
what tell/1 redirects) but rather to top_level_output. I don't know if 
there's any way to redirect top_level_output. (I would think listing/1 
*should* use stdout.)

You can write listing/1 to an arbitrary stream using a *mirror*:

?- open('foo', write, S), add_stream_mirror(top_level_output, S), 
listing(kb), close(S).

This will write the listing for kb to file 'foo'.

On Nov 23, 2005, at 11:44 AM, Nuno Morgadinho wrote:

> Shouldn't listing/1 use the output stream set by tell/1?
>
> example:-
> 	tell('example.pl'),
> 	listing(something/2),
> 	told.
>
>
> This doesn't work for me with gprolog-1.2.18 on x86.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.