[mercury-users] partial instantiation?

Ralph Becket rafe at csse.unimelb.edu.au
Mon Apr 19 17:39:28 AEST 2010


Tomas, Monday, 19 April 2010:
> 
> Also, the way you have written it, the parameters are not passed to the
> commands.

One of is mistaken here!  Given,

:- pred cmd(string,list(cmdarg),cmdproc).
:- mode cmd(out,out,out) is nondet.

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)          ).

if I have

	CmdNamd = "command",
	F = "foo",
	N = 42,
	Args = [str(F), int(N)],
	cmd(CmdNamd, Args, Command)

then Command will be unified with dosomething(42, "foo").  Isn't
that what you need?

-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list