[m-users.] Adding impurity to Mercury code: Backtracking in IO states

Left Right olegsivokon at gmail.com
Mon Jun 29 03:15:28 AEST 2015


@Tomas, is "unique" similar to Prolog's atom(X) when it's used to
format a string, like format(atom(X), '~p', [x])? I too find this
concept not very easy to understand.

Re' IOState_out - yes, I confused it to something else. Also, where it
says grounded it should say ground :)

On Sun, Jun 28, 2015 at 2:32 PM, Tomas By <tomas at basun.net> wrote:
> On Sun, June 28, 2015 07:34, Left Right wrote:
>> One problem
>> is that you are trying to unify two grounded terms, knowing they are
>> already grounded and distinct. For instance: IOState_out = IOState_in
>
> IOState_out is not ground.
>
> The line "IOState_out = IOState_in" just means nothing happens on that
> side in the disjunction.
>
>
>> In particular,
>> io.write_string needs its third argument to be instantiated as
>> "unique" (this is a Mercury's way of saying it has to be obtained from
>> doing some other I/O).
>
> I think it is just an historical accident that Mercury only uses unique
> modes for I/O.
>
> /Tomas
>
>



More information about the users mailing list