<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I read this page for a good time now:<br class=""><br class=""><a href="https://mercurylang.org/information/doc-latest/mercury_ref/Predicate-and-function-mode-declarations.html#Predicate-and-function-mode-" class="">https://mercurylang.org/information/doc-latest/mercury_ref/Predicate-and-function-mode-declarations.html#Predicate-and-function-mode-</a>declarations<br class=""><br class="">…with the relevant part being:<br class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><br class="">>A function or predicate mode declaration is an assertion by the programmer that for all possible argument terms and (if applicable) result term for the function or predicate that are approximated (in our technical sense) by the initial instantiatedness trees of the mode declaration and all of whose free variables are distinct, if the function or predicate succeeds, then the resulting binding of those argument terms and (if applicable) result term will in turn be approximated by the final instantiatedness trees of the mode declaration, with all free variables again being distinct. We refer to such assertions as mode declaration constraints. These assertions are checked by the compiler, which rejects programs if it cannot prove that their mode declaration constraints are satisfied.</blockquote><br class="">That’s a wake up call. Up to this point I had not made the connection between the declared determinism and the modes. It’s a lot to take in and it’s too late for my brain. I guess in the morning I will read it again and work on it. I am not schooled in predicate logic or maths; what I know I have taught myself as and when I need to for 35 years and counting but Mercury (and Prolog) continue to be most challenging. When you don’t know what half of the documentation is saying because the language is so hard to interpret into something meaningful to a mere mortal it feels very hard at times. But I haven’t given up thus far, the code I have feels incredibly lean and safe. Very reassuring actually.<br class=""><br class="">Any links to learning resources that might help me on the way would be nice to see.<br class=""><br class="">Good night!<br class="">Sean<br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On 5 May 2021, at 23:00, Zoltan Somogyi <zoltan.somogyi@runbox.com> wrote:<br class=""><br class=""><br class=""><br class="">On Wed, 5 May 2021 22:55:11 +0100, "Sean Charles (emacstheviking)" <objitsu@gmail.com> wrote:<br class=""><blockquote type="cite" class="">:- pred translate_(<br class=""><span class="Apple-tab-span" style="white-space:pre">    </span>command_line.felt_options::in,<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>list(string)::in,<br class=""><span class="Apple-tab-span" style="white-space:pre">      </span>list(string)::out,<br class=""><span class="Apple-tab-span" style="white-space:pre">     </span>io::di, io::uo) is det.<br class=""></blockquote><br class="">This promises that when translate_ succeeds, the third arg<br class="">will be ground, but ...<br class=""><br class=""><blockquote type="cite" class="">translate_(_, [], _Acc, !IO) :-<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>trace [<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">    </span>run_time(env("FELT_DBG")),<br class=""><span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span>io(!Dbg)<br class=""><span class="Apple-tab-span" style="white-space:pre">       </span>]<br class=""><span class="Apple-tab-span" style="white-space:pre">      </span>(io.format("translate_: all done\n", [], !Dbg)).<br class=""></blockquote><br class="">... as the error message says, this clause does NOT make it ground.<br class=""><br class="">Zoltan.<br class=""><br class=""><br class=""></blockquote><br class=""></body></html>