Re: write_canonical and streams

Wouter Beek <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAE1un7P3Gbh3U=eRiF3S432jocbenwbfn6z4=Dz5cLfCZDG92Q@mail.gmail.com>
On Wed, Feb 12, 2014 at 10:21 AM, Wielemaker, J. <[email protected]> wrote:
> On 02/12/2014 09:42 AM, Wouter Beek wrote:
>> portray(Term):-
>>    (is_stream(Term) ; blob(Term, stream)), !,
>
> The disjunction doesn't help much; they are the
> same test.  You probably want this:
>
>         blob(Term, Type),
>         Type \== text.
>
> That is because atom(X) ==> blob(X, text). All
> the others are somehow special.
>
>>    write(monkey).
>>
>> test:-
>>    open('README.md', read, Stream),
>>    write_term(Stream, [blob(portray)]),
>
> It is blobs(portray).
Oops, my bad, it works fine now, thanks!
>
>         --- Jan
>
>>    nl,
>>    halt.
>
>
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.