[m-dev.] Unique Modes and Transaction Logic

Julien Fischer jfischer at opturion.com
Tue Jul 8 17:30:08 AEST 2014


On Tue, 8 Jul 2014, Mark Brown wrote:
>>> Additionally, pure, reversible
>>> /assert/ and /retract/ semantics can even be used in semidet and nondet
>>> contexts without leading to inconsistent states.
>>
>> There was a more general proposal to achieve something similar to this.  You
>> would still need to use solutions/2 to create a list but then you could
>> iterate over the list using a loop.
>>
>> Also do you know that you can use list.foldl to help print out a list?
>>
>>         foldl(print_item, List, !IO),
>>
>>     :- pred print_item(string::in, io::di, io::uo) is det.
>>
>>     print_item(String, !IO) :-
>>         write_string(String, !IO),
>>         nl(!IO).
>>
>
> Also io.print_line  ;-)

... is so new that it hasn't yet made it into a stable release ;-)
For the current stable release,

     write_list(List, "\n", write_string, !IO)

Cheers,
Julien.



More information about the developers mailing list