[mercury-users] partial instantiation?
pbone at csse.unimelb.edu.au
Wed Apr 14 13:56:13 AEST 2010
On Wed, Apr 14, 2010 at 01:52:39PM +1000, Paul Bone wrote:
> On Wed, Apr 14, 2010 at 05:38:04AM +0200, Tomas By wrote:
> > On Wed, April 14, 2010 05:14, Paul Bone wrote:
> > > On Wed, Apr 14, 2010 at 05:03:02AM +0200, Tomas By wrote:
> > >> I suspect I would also need complicated mode declarations for the third
> > >> parameter (cmdproc), as that also has free variables?
> > >
> > > Yes, that's right.
> > Ok, thanks, I will see if I can get it to work.
> > Just one more question right now: how many different inst/mode declarations
> > (for parameter three) will I need here?
> > |cmd( "command", , dosomething(0,"filename") ).
> > |cmd( "command", [str(F)], dosomething(0,F) ).
> > |cmd( "command", [int(N)], dosomething(N,"filename") ).
> > |cmd( "command", [str(F),int(N)], dosomething(N,F) ).
> > Four? (bound-bound, bound-free, free-bound, free-free)
> Now that I look more closely in some cases (of cmd/3) you are fully
> instantiating the 2nd and 3rd arguments, and it other cases you are only using
> partial instantiation. You need to use either one or the other in _all_ cases.
> Try to work out why you _need_ partial instantiation. If you can't find a good
> reason then you don't need it :-). It might also be useful to re-think your
> data structures, try using the maybe type within the arguments of the
> dosomething constructor.
(actually, I don't think maybe will do what you want either.
I also suspect that you think that Mercury supports logic variables, it does
X = Y,
Y = 3
In prolog this will bind X to 3. In Mercury this is not valid.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 489 bytes
Desc: Digital signature
More information about the users