<div dir="ltr">At <a href="http://rosettacode.org/wiki/Concurrent_computing#Mercury">http://rosettacode.org/wiki/Concurrent_computing#Mercury</a>, we see:<div><br></div><div><div>main(!IO) :-</div><div> spawn(io.print_cc("Enjoy\n"), !IO),</div>
<div> spawn(io.print_cc("Rosetta\n"), !IO),</div><div> spawn(io.print_cc("Code\n"), !IO).</div></div><div><br></div><div>It is a bit hard to understand how this could work. My beginner's understanding would be that the 2nd spawn couldn't happen till the first had produced the new world that is its input parameter. Etc.</div>
<div><br></div><div>And my compilation of it (on OSX) produces the outputs in the same order as in the program every time.</div><div><br></div><div>It is interesting to consider how languages which explicitly thread IO (like Haskell and Mercury) should handle multiple interactions with the world where the order doesn't matter, so that concurrency can be done implicitly or explicitly.</div>
<div><br></div><div>rks</div></div>