[mercury-users] Another Mercury Modes Problem

Bob McKay bob_mckay at mac.com
Fri May 31 10:16:52 AEST 2002


On Tuesday, May 28, 2002, at 04:00 PM, David Overton wrote:

> On Tue, May 28, 2002 at 04:45:12PM +1000, Ralph Becket wrote:
>> David Overton, Tuesday, 28 May 2002:
>>> On Tue, May 28, 2002 at 03:01:07PM +1000, Ralph Becket wrote:
>>>>
>>>>     % These should be built-in, but aren't...
>>>>     %
>>>> :- mode di(I) == unique(I) >> dead.
>>>> :- mode uo(I) ==      free >> unique(I).
>>>
>>> The inst `unique(...)' takes a list of functors separated by `;' (the 
>>> same
>>> as `bound(...)'), not an inst.
>>
>> I was unsure of that syntax.  How does one apply the unique attribute 
>> to
>> a named inst?
>
> You can't at the moment, although it might be a useful feature to add.

This seems to be the killer for what I am trying to do. My primary
aim is to implement a new evolutionary algorithm and representation.
But I had intended to do this in a systematic way, with a top-level
module containing a generic evolutionary algorithm and parametric
data types, a middle level which instantiates the generic algorithm
and data types to a particular representation and algorithm, and a
bottom level which then instantiates it further to a particular
problem.

I think I can handle the typing OK (although I've been caught enough
times now by Mercury gotchas that I wouldn't be prepared to bet on
it until I see it compile). But I can't see a way around the above
for modes, ie it doesn't seem to be possible to have complex
parametric modes because it's not possible to pass into mode
definitions (whose parameters are insts) the parameters required by
'unique' and 'bound' (ie functors).

Am I missing the point here - ie is there another way to accomplish
my aim in Mercury? Or should I just cut my losses now?

	Best Wishes
	Bob McKay


Signature: I am using this email account for efficiency reasons while 
travelling. It is not my primary account. Please send replies for 
preference to rim at cs.adfa.edu.au (mac mail does not appear to have a 
mechanism to set the reply-to field)

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list