[mercury-users] Modes problem
Ondrej Bojar
oboj7042 at ss1000.ms.mff.cuni.cz
Sat May 19 00:09:08 AEST 2001
Hi.
I get this message:
extract.m:023: In clause for `extract(in, in, out)':
extract.m:023: in argument 2 of call to function `std_util:pair/2':
extract.m:023: mode error: variable `AVal' has instantiatedness `free',
extract.m:023: expected instantiatedness was `ground'.
What I am trying to do is this (simplified version of the problem):
:- pred test(list(pair(string))::in).
test([Head|Tail]) :-
Head = pair(A,A).
The predicate test should succeed if and only if the given list (is
nonempty and) starts with a pair of identic structures.
Here, the error is similar:
pok.m:007: In clause for `test(in)':
pok.m:007: in argument 1 of call to function `std_util:pair/2':
pok.m:007: mode error: variable `A' has instantiatedness `free',
pok.m:007: expected instantiatedness was `ground'.
How should I write it? I need to get first element of the list, whatever
it is, then try to unify it with soemthing (and backtrack, if that fails).
Thanks again a lot for your help,
Andrew.
--------------------------------------------------------------------------
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