<div dir="ltr"><div>Thanks Richard!</div><div><br></div>That is so obvious when you see it. I am thinking like a Haskell hacker this evening for sure.<div>I changed it to "cc_multi" and it compiled ANd did what I expected / wanted.</div><div><br></div><div>In my prolog code I have a cut after each match to commit (cc_multi!!!) to that and no more....OMG (trust me I have to be desparate to even think that acronym) it really does match !!! I am going to stick that response on a post-it under my monitor for a whole month!</div><div><br></div><div>Currently re-reading section 6 of the manual...sigh...these are the times when I just know that a formal education might have helped me stumble and fall a little less.</div><div><br></div><div>Thanks again,</div><div>Sean.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 4 Jul 2019 at 23:40, Richard O'Keefe <<a href="mailto:raoknz@gmail.com">raoknz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:Arial,Helvetica,sans-serif">char_type(')', p_open).</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">char_type('(', p_close).</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">char_type(_, c_general).</span><br></div><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:Arial,Helvetica,sans-serif">')' matches two clauses, the first and last.</span></div><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:Arial,Helvetica,sans-serif">'(' matches two clauses, the second and last.</span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 5 Jul 2019 at 10:24, emacstheviking <<a href="mailto:objitsu@gmail.com" target="_blank">objitsu@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">To paraphrase Neo, "I know Prolog".<div><br></div><div>but I don't know Mercury and I am struggling to figure out this error....I am porting some old SWI code and it boils down to the fact that I obvuisly don't truly understand what "det" means! Here is the code both as discrete disjunctive clauses and a single big disjunct:</div><div><br></div><div>:- pred char_type(char::in, chartype::out) is det.<br><br></div><div>char_type(')', p_open).<br>char_type('(', p_close).<br>char_type(_, c_general).<br><br>char_type(C, T) :-<br>    (<br>        C = '(', T = p_open<br>    ;   C = ')', T = p_close<br>    ;   C = _,   T = c_general<br>    ).<br></div><div><br></div><div>and here is the compiler output:</div><div><br></div><div>fl1.m:049: In `char_type'(in, out):<br>fl1.m:049:   error: determinism declaration not satisfied.<br>fl1.m:049:   Declared `det', inferred `multi'.<br>fl1.m:056:   Disjunction has multiple clauses with solutions.<br></div><div><br></div><div>Now...I understand why (I think) this happens: it's because the final matching disjuny can match more than one character value hence the multiple (multi) classification by the compiler BUT he calling loop seeks merely to convert a character into a character type.</div><div><br></div><div>Is this "cc_multi" in disguise as if the character is not one of the ones explicitly tested for then I will commit to the first choice as it will be a "general" character i.e. one with no special meaning to my little lexer.</div><div><br></div><div>Thank you,</div><div>Sean.</div><div><br></div></div>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.mercurylang.org" target="_blank">users@lists.mercurylang.org</a><br>
<a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a><br>
</blockquote></div>
</blockquote></div>