From maclarty@... Mon Apr 10 01:56:12 2006 Date: Mon, 10 Apr 2006 09:56:05 +1000 From: Ian MacLarty To: Adrian Pop Subject: Re: small Mercury help Hi Adrian, On 4/10/06, Adrian Pop wrote: > > Hi, > > I'm trying to port a small Prolog program to > Mercury and I'm having problems with modes > for one predicate. > > This is for a small performance evaluation > Mercury vs. RML (http://www.ida.liu.se/~pelab/rml) > and I would really like to get it to work > because in many aspects RML is quite close > to Mercury. > The error I get is a mode error on line 106: mf.m:106: In clause for `newenv(in, in, out, out)': mf.m:106: in argument 1 of call to predicate `mf.newenv/4': mf.m:106: mode error: variable `V_14' has instantiatedness `free', mf.m:106: expected instantiatedness was `ground'. You are getting this error because you are using RHO2 in the construction of argument 1 of the call to newenv on line 106, but RHO2 is free (it has mode 'out' in the head). The compiler expects the first argument of newenv to be ground, since it has mode 'in'. Remember you can't unfiy two free variables in Mercury, like you can in Prolog. Also, at the moment, Mercury doesn't support partially instantiated data structures. So basically you need to rethink how to implement newenv given these constraints. I hope this helps. Let me know if you have any more problems and I'll try and help as best I can. You may also want to consider subscribing to the mercury-users mailing list and posting you questions there, as then you'll get help from more people. Ian.