Re: listing/1 behavior

Nuno Morgadinho <[email protected]>
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Ok, found it. Just for the archives, from [1] 

"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'.


Lindsey Spratt"

Having the problem solved, I still wonder why listing/1 doesn't write to
stdout but rather to top_level_output. I agree with Lindsey when she says
it should use stdout.

Cheers,

[1] - http://lists.gnu.org/archive/html/bug-prolog/2005-11/msg00003.html
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.