[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Users-prolog Digest, Vol 32, Issue 1
From: |
Duncan Patton a Campbell |
Subject: |
Re: Users-prolog Digest, Vol 32, Issue 1 |
Date: |
Wed, 7 Sep 2005 12:26:31 -0600 |
On Mon, 5 Sep 2005 10:01:54 -0600 (MDT)
I haven't had much luck with the open/4(.,.,.,Options) syntax myself.
Instead I use open/3 and set_stream_type/2.
Dhu
[]
> Hi,
>
> I'd like some help trying to understand the use of streams. As I understand,
> this should produce a file 'out.txt', with the listing in it. However, the
> listing gets printed to the screen, and the file is empty:
>
> | ?- open('out.txt', write, H, [alias(out)]), current_output(COUT),
> set_output(out), listing, set_output(COUT).
>
> squint([], []).
> squint([A|B], [C|D]) :-
> integer(A),
> C is A * A,
> squint(B, D).
> squint([A|B], [A|C]) :-
> squint(B, C).
>
> COUT = '$stream'(1)
> H = '$stream'(2)
>
> (1 ms) yes
> | ?-
>
> If anyone has any ideas, suggestions, anything, please reply.
> Thanks and have a great weekend.
> Cliff
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.gnu.org/pipermail/users-prolog/attachments/20050905/632ac3ec/attachment.html
>
> ------------------------------
>
> Message: 3
> Date: Mon, 05 Sep 2005 16:05:45 +0200
> From: A-S Saidi <address@hidden>
> Subject: Re: streams
> To: Cliff Bender <address@hidden>
> Cc: gprolog <address@hidden>
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset="us-ascii"
>
> An HTML attachment was scrubbed...
> URL:
> http://lists.gnu.org/pipermail/users-prolog/attachments/20050905/32c17ca1/attachment.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Alexandre.Saidi.vcf
> Type: text/x-vcard
> Size: 395 bytes
> Desc: not available
> Url :
> http://lists.gnu.org/pipermail/users-prolog/attachments/20050905/32c17ca1/Alexandre.Saidi.vcf
>
> ------------------------------
>
> Message: 4
> Date: Mon, 05 Sep 2005 11:18:16 -0400
> From: Vic Bancroft <address@hidden>
> Subject: Re: streams
> To: Cliff Bender <address@hidden>
> Cc: gprolog <address@hidden>
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> 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
>
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/users-prolog
>
>
> End of Users-prolog Digest, Vol 32, Issue 1
> *******************************************
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Users-prolog Digest, Vol 32, Issue 1,
Duncan Patton a Campbell <=