|
From: | Cliff Bender |
Subject: | Re: streams |
Date: | Tue, 6 Sep 2005 21:40:44 -0400 |
Cliff Bender wrote:
>I'd like some help trying to understand the use of streams.
>
Hurrms, not sure what is broken w/ your example, however, I tend to use
the format construct.
$ gprolog
GNU Prolog 1.2.18
By Daniel Diaz
Copyright (C) 1999-2004 Daniel Diaz
| ?- assertz(p(1)), assertz(p(2)).
yes
| ?- open('out.log', write, H), (p(X), format(H, "p(~w) ~n", [X]),
fail; close(H)), !.
H = '$stream'(2)
(1 ms) yes
| ?- system('cat out.log').
p(1)
p(2)
(1 ms) yes
This explicit indication of the target stream is useful in context where
there is more than one and it also gives you more control over what is
sent to the stream . . .
more,
l8r,
v
--
"The future is here. It's just not evenly distributed yet."
-- William Gibson, quoted by Whitfield Diffie
[Prev in Thread] | Current Thread | [Next in Thread] |