[mercury-users] partial instantiation?

Tomas By tomas at basun.net
Mon Apr 19 18:00:56 AEST 2010

On Mon, April 19, 2010 09:39, Ralph Becket wrote:
> 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!

Well, my comment above was about your code, where the N was all alone by

>  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?

I thought we had established that the above will not compile, but in the
alternative universe where it works it is still not what I mean, because:

What I get on the command line is ["command","foo","42"], but it could
have been just ["command","42"] where "42" could have been a filename.

This is for experimentation. I want to be able to modify the commands
and parameters easily. Doing a lot of fancy interpretation of the command
line before I get to cmd/X seems misguided.


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