[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: listing/1 behavior
From: |
Lindsey Spratt |
Subject: |
Re: listing/1 behavior |
Date: |
Wed, 23 Nov 2005 12:19:17 -0500 |
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.