[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: streams
From: |
Vic Bancroft |
Subject: |
Re: streams |
Date: |
Mon, 05 Sep 2005 11:18:16 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.2-6 (X11/20050513) |
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
- streams, Cliff Bender, 2005/09/05
- Re: streams, A-S Saidi, 2005/09/05
- Re: streams,
Vic Bancroft <=