<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I have created a predicate called bifmap/2 that is declared as nondet, as given the same input string, the body of a token, it could produce more than one result as I allow alternative forms in my language eg, “o>” and “emit”, “λ” and “defun” etc. I am trying to implem,ent a help functio for my repl, and the issue I have is again trying to figure out what the compiler is telling me, the error is:</div><div class=""><br class=""></div><font face="Courier" style="font-size: 14px;" class="">mmc -s hlc.gc -O4 -E --make felt<br class="">Making Mercury/int3s/words.int3<br class="">Making Mercury/ints/words.int<br class="">Making Mercury/cs/words.c<br class="">words.m:230: In clause for `bifmap(in, out)':<br class="">words.m:230:   mode mismatch in disjunction.<br class="">words.m:230:   The variable `HeadVar__2' is ground in 118 out of 119 branches.<br class="">words.m:230:   It has the following instantiation states.<br class="">words.m:109:     In this branch, `HeadVar__2' has the ground instantiatedness<br class="">words.m:109:       unique(binaryop(unique(gt))).<br class="">words.m:110:     In this branch, `HeadVar__2' has the ground instantiatedness<br class="">words.m:110:       unique(binaryop(unique(lt))).<br class="">words.m:111:     In this branch, `HeadVar__2' has the ground instantiatedness<br class="">words.m:111:       unique(binaryop(unique(gte))).<br class="">words.m:112:     In this branch, `HeadVar__2' has the ground instantiatedness<br class="">words.m:112:       unique(binaryop(unique(lte))).<br class="">words.m:113:     In this branch, `HeadVar__2' has the ground instantiatedness<br class="">words.m:113:       unique(binaryop(unique(neq))).<br class="">words.m:114:     In this branch, `HeadVar__2' has the ground instantiatedness<br class="">... error log truncated, see `words.err' for the complete log.<br class="">** Error making `Mercury/cs/words.c'.<br class="">make: *** [felt] Error 1<br class=""></font><div class=""><font face="Courier" style="font-size: 14px;" class="">The terminal process "/bin/zsh '-c', 'make'" terminated with exit code: 2. </font></div><div class=""><br class=""></div><div class="">In the words.err file it has listed every single line of my predicate. In this case the disjunction (I think) is the entire set of bifmap/2 declarations. I have attached the complete contents of my source file this time, sorry for the size of it. I am pretty sure I don’t have any duplicates either, this has been a long cut and paste and totally reorganise from my Prolog code so I suspected some kind of cut and paste error could have crept in but if so I have failed to spot it.</div><div class=""><br class=""></div><div class="">I am also assuming that `nondet` is correct for its determinism, I know it CAN fail i.e. a string that is not a keyword and for the examples given above it could succeed more than once.</div><div class=""><br class=""></div><div class="">Thank you</div><div class="">Sean</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">— words.m —</div><div class=""><font face="Courier" style="font-size: 14px;" class="">:- module words.<br class="">:- interface.<br class="">    % Binary Operator Types<br class="">:- type bop_type ---> gt ; lt ; gte ; lte ; neq ; eq_typed ; neq_typed ; eq .<br class="">    % Nary Operator Types<br class="">    % the _ stops reserved word errors!  :|<br class="">:- type nop_type ---> add_ ; sub_ ; mult_ ; div_ ; and_ ; or_ ; mod_ ; bitand_ ; bitor_ ; xor_.<br class="">    % Unary op types<br class="">:- type uop_type ---> not_.<br class="">    % Access Control Levels<br class="">:- type acl ---> public ; protected ; private.<br class="">    % The complete FELT instruction set<br class="">:- type instruction<br class="">        --->    pre_when<br class="">        ;       alen<br class="">        ;       alist<br class="">        ;       apop<br class="">        ;       apply<br class="">        ;       apply_star<br class="">        ;       apush<br class="">        ;       aref<br class="">        ;       array<br class="">        ;       as<br class="">        ;       ashift<br class="">        ;       assign<br class="">        ;       aunshift<br class="">        ;       binaryop(bop_type)<br class="">        ;       break<br class="">        ;       cast<br class="">        ;       catch_<br class="">        ;       class<br class="">        ;       classcall<br class="">        ;       concat<br class="">        ;       const<br class="">        ;       constc<br class="">        ;       continue<br class="">        ;       crash<br class="">        ;       cvar(acl)<br class="">        ;       decf<br class="">        ;       decr<br class="">        ;       defclass<br class="">        ;       define<br class="">        ;       define_star<br class="">        ;       defstatic<br class="">        ;       defun_pu<br class="">        ;       defun_pro<br class="">        ;       emit<br class="">        ;       lambda<br class="">        ;       defun(acl)<br class="">        ;       defunc(acl)<br class="">        ;       defvar<br class="">        ;       false_<br class="">        ;       for_<br class="">        ;       foreach<br class="">        ;       if_<br class="">        ;       incf<br class="">        ;       include<br class="">        ;       include_once<br class="">        ;       incr<br class="">        ;       instanceof<br class="">        ;       interface<br class="">        ;       mcall<br class="">        ;       methodcall<br class="">        ;       mvar(acl)<br class="">        ;       my<br class="">        ;       naryop(nop_type)<br class="">        ;       new<br class="">        ;       progn<br class="">        ;       require<br class="">        ;       require_once<br class="">        ;       return<br class="">        ;       return_star<br class="">        ;       setq<br class="">        ;       switch<br class="">        ;       throw_<br class="">        ;       true_<br class="">        ;       try_<br class="">        ;       typecast<br class="">        ;       typeof<br class="">        ;       unaryop(uop_type)<br class="">        ;       until<br class="">        ;       while.<br class=""><br class="">:- pred bifmap(string::in, instruction::out) is nondet.<br class=""><br class="">:- implementation.<br class="">:- import_module list, string.<br class="">    %<br class="">    % Built-In Function (bif) map.<br class="">    % This predicate contains a mapping from the input string in the left to<br class="">    % the actual reserved word on the right. It can be used as a bidirectional<br class="">    % mapping but for now it is one way only.<br class="">    %<br class="">bifmap(">",binaryop(gt)).<br class="">bifmap("<",binaryop(lt)).<br class="">bifmap(">=",binaryop(gte)).<br class="">bifmap("<=",binaryop(lte)).<br class="">bifmap("!=",binaryop(neq)).<br class="">bifmap("===",binaryop(eq_typed)).<br class="">bifmap("!==",binaryop(neq_typed)).<br class="">bifmap("==",binaryop(eq)).  % some targets allow this<br class=""><br class="">bifmap("+",naryop(add_)).<br class="">bifmap("-",naryop(sub_)).<br class="">bifmap("*",naryop(mult_)).<br class="">bifmap("/",naryop(div_)).<br class="">bifmap("%",naryop(mod_)).<br class="">bifmap("&",naryop(bitand_)).<br class="">bifmap("|",naryop(bitor_)).<br class=""><br class="">bifmap("#f:when(",pre_when).<br class=""><br class="">bifmap("alen",alen).<br class="">bifmap("@#",alen).<br class="">bifmap("alist",alist).<br class="">bifmap("and",naryop(and_)).<br class="">bifmap("&&",naryop(and_)).<br class="">bifmap("apop",apop).<br class="">bifmap("apply",apply).<br class="">bifmap("apply*",apply_star).<br class="">bifmap("apush",apush).<br class="">bifmap("@>",apush).<br class="">bifmap("aref",aref).<br class="">bifmap("@",aref).<br class="">bifmap("@<",apop).<br class="">bifmap("array",array).<br class="">bifmap("as",as).<br class="">bifmap("ashift",ashift).<br class="">bifmap(">@",ashift).<br class="">bifmap("assign",assign).<br class="">bifmap("=",assign).<br class="">bifmap("aunshift",aunshift).<br class="">bifmap("<@",aunshift).<br class="">bifmap("break",break).<br class="">bifmap("cast",cast).<br class="">bifmap("class",class).<br class="">bifmap("class-call",classcall).<br class="">bifmap("::",classcall).<br class="">bifmap("concat",concat).<br class="">bifmap(".",concat).<br class="">bifmap("const",const).<br class="">bifmap("constc",constc).<br class="">bifmap("continue",continue).<br class="">bifmap("crash",catch_).<br class="">bifmap("cvar",cvar(public)).<br class="">bifmap("cvar#",cvar(protected)).<br class="">bifmap("cvar+",cvar(public)).<br class="">bifmap("cvar-",cvar(private)).<br class="">bifmap("decf",decf).<br class="">bifmap("--",decf).<br class="">bifmap("decr",decr).<br class="">bifmap("defclass",defclass).<br class="">bifmap("define",define).<br class="">bifmap("define*",define_star).<br class="">bifmap("defstatic",defstatic).<br class="">bifmap("defun",defun(public)).<br class="">bifmap("λ",defun(public)).<br class="">bifmap("λ*",lambda).<br class="">bifmap("defun#",defun(protected)).<br class="">bifmap("defun*",lambda).<br class="">bifmap("defun+",defun(public)).<br class="">bifmap("defun-",defun(private)).<br class="">bifmap("defunc",defunc(public)).<br class="">bifmap("defunc#",defunc(public)).<br class="">bifmap("defunc+",defunc(protected)).<br class="">bifmap("defunc-",defunc(private)).<br class="">bifmap("defvar",defvar).<br class="">bifmap(":=",defvar).<br class="">bifmap("o>",emit).<br class="">bifmap("emit",emit).<br class="">bifmap("false",false_).<br class="">bifmap("#f",false_).<br class="">bifmap("for",for_).<br class="">bifmap("foreach",foreach).<br class="">bifmap("function",defun(public)).<br class="">bifmap("function*",lambda).<br class="">bifmap("functionc",defstatic). % CHECK!<br class="">bifmap("if",if_).<br class="">bifmap("incf",incf).<br class="">bifmap("++",incf).<br class="">bifmap("include",include).<br class="">bifmap("include-once",include_once).<br class="">bifmap("incr",incr).<br class="">bifmap("instanceof",instanceof).<br class="">bifmap("interface",interface).<br class="">bifmap("lambda",lambda).<br class="">bifmap("mcall",methodcall).<br class="">bifmap("->",methodcall).<br class="">bifmap("mvar",mvar(public)).<br class="">bifmap("mvar#",mvar(protected)).<br class="">bifmap("mvar+",mvar(public)).<br class="">bifmap("mvar-",mvar(private)).<br class="">bifmap("my",my).<br class="">bifmap("new",new).<br class="">bifmap("not",unaryop(not_)).<br class="">bifmap("!",unaryop(not_)).<br class="">bifmap("¬",unaryop(not_)).<br class="">bifmap("or",naryop(or_)).<br class="">bifmap("||",naryop(or_)).<br class="">bifmap("progn",progn).<br class="">bifmap("require",_).<br class="">bifmap("require-once",require_once).<br class="">bifmap("return",return).<br class="">bifmap("return*",return_star).<br class="">bifmap("setq",setq).<br class="">bifmap("switch",switch).<br class="">bifmap("throw",throw_).<br class="">bifmap("true",true_).<br class="">bifmap("#t",true_).<br class="">bifmap("try",try_).<br class="">bifmap("typeof",typeof).<br class="">bifmap("until",until).<br class="">bifmap("while",while).<br class="">bifmap("xor",naryop(xor_)).<br class="">bifmap("^",naryop(xor_)).<br class=""></font><br class=""></div></body></html>