<div dir="ltr"><div><div><div><div><div>I'm pretty sure you need to import the integer library in order to get the definition for the '+' operator.</div><div><br></div><div>":- import_module integer"<br></div><div><br></div>The error is actually that it doesn't have a definition for "an add function accepting two arguments" (+/2) in the compilation unit, but I don't have a mercury compiler on the windows box I'm using right now so I can't test it quickly :/<br><br></div>There are a lot of libraries that have to be included in mercury that you just sort of get by default in other languages, so it tends to be the first thing I try with errors like "I don't know how to add" or "I don't know what a string is" etc...<br><br></div>I suspect the rational is something of a combination of "Keep the actual language as small as possible" and "speed compilation time by ensuring only the bare minimum is included" but other's will have to address that authoritatively (as opposed to my speculation).<br></div><div><br></div><div>Also, looking at your length function, I suspect you don't need it, but I had to pick up a prologue book to supplement the tutorial. The two languages are really similar so it worked out really well for me.<br></div><div><br></div><div><br></div>Cheers!<br><br></div>Charles<br><div><div><div><br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 7, 2017 at 7:32 PM, zeldangit <span dir="ltr"><<a href="mailto:zeldangit@gmail.com" target="_blank">zeldangit@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hello,<br><br></div>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. <a href="https://gist.github.com/zeldangit/9448809d80f7613d74189feb9f5529ac" target="_blank">Here it is along with the error I am having</a>. Any help would be much appreciated.<br><br></div>Thanks,<br></div>
<br>______________________________<wbr>_________________<br>
users mailing list<br>
<a href="mailto:users@lists.mercurylang.org">users@lists.mercurylang.org</a><br>
<a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/<wbr>listinfo/users</a><br>
<br></blockquote></div><br></div>