[m-users.] Stuck trying to compile simple program

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Nov 8 12:40:51 AEDT 2017



On Tue, 7 Nov 2017 20:32:18 -0500, zeldangit <zeldangit at gmail.com> wrote:
> I am currently making my way through Ralph Becket Mercury tutorial and I am
> stuck trying to add a simple length function to my program. Here it is
> along with the error I am having
> <https://gist.github.com/zeldangit/9448809d80f7613d74189feb9f5529ac>. Any
> help would be much appreciated.

You didn't import the int module. In Mercury, the arithmetic operations
on a type such as int or float are in scope only if you import the Mercury
standard library module that defines those operations. (You would be
surprised by how many modules don't do any arithmetic at all.)

After you fix that error, you will get another one about the call to length
in the second clause being ambiguous, because the list module also defines
a function named length. You will need to either rename your function
or add a module qualification to the call to remove the ambiguity.

Zoltan.


More information about the users mailing list