[m-users.] Predicate declared nondet error: mode mismatch in disjunction.

Sean Charles (emacstheviking) objitsu at gmail.com
Thu May 20 22:26:33 AEST 2021


I am using:

{13:25}~/Documents/code/mercury/f2:keyword-recog ✗ ➭ mmc --version
Mercury Compiler, version 20.06.1, on x86_64-apple-darwin19.6.0
Copyright (C) 1993-2012 The University of Melbourne
Copyright (C) 2013-2020 The Mercury team

and
>> bifmap("require",_).

Why is it I never see these things before posting. I looked and looked and fixed a lit of things but… thank you Zoltan.


> On 20 May 2021, at 12:14, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> 
> 
> 2021-05-20 21:03 GMT+10:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com <mailto:objitsu at gmail.com>>:
>> Hi,
>> 
>> 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:
>> 
>> mmc -s hlc.gc -O4 -E --make felt
>> Making Mercury/int3s/words.int3
>> Making Mercury/ints/words.int
>> Making Mercury/cs/words.c
>> words.m:230: In clause for `bifmap(in, out)':
>> words.m:230:   mode mismatch in disjunction.
>> words.m:230:   The variable `HeadVar__2' is ground in 118 out of 119 branches.
>> words.m:230:   It has the following instantiation states.
>> words.m:109:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:109:       unique(binaryop(unique(gt))).
>> words.m:110:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:110:       unique(binaryop(unique(lt))).
>> words.m:111:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:111:       unique(binaryop(unique(gte))).
>> words.m:112:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:112:       unique(binaryop(unique(lte))).
>> words.m:113:     In this branch, `HeadVar__2' has the ground instantiatedness
>> words.m:113:       unique(binaryop(unique(neq))).
>> words.m:114:     In this branch, `HeadVar__2' has the ground instantiatedness
>> ... error log truncated, see `words.err' for the complete log.
>> ** Error making `Mercury/cs/words.c'.
>> make: *** [felt] Error 1
>> The terminal process "/bin/zsh '-c', 'make'" terminated with exit code: 2. 
> 
> You must be using an old Mercury compiler. On recent compilers, the error
> message is much shorter and to the point:
> 
> words.m:215: In clause for `bifmap(in, out)':
> words.m:215:   mode mismatch in disjunction.
> words.m:215:   The variable `HeadVar__2' is ground in 118 out of 119 branches.
> words.m:201:     In this branch, `HeadVar__2' is free.
> 
> This info is also in the error output you would have got, but your error log got truncated
> before that.
> 
> Line 201 says:
> 
>> bifmap("require",_).
> 
> Since _ is the anonymous variable in Mercury as in Prolog, if the input is "require",
> bifmap does not bind its second argument.
> 
> Zoltan.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20210520/452e5e34/attachment-0001.html>


More information about the users mailing list