[mercury-users] What mode is necessary?

Mike Potanin potanin at mccme.ru
Wed Nov 20 21:40:47 AEDT 2002


 Hi!
I want to make pred which receives on an input list_skel(free)
and ground on an output. Like satisfy_request from manual.
I make code:
:-inst listskel(Inst) == bound( [] ; [Inst | listskel(Inst)] ).
:-pred preffix(list(T), list(T)).
:-mode preffix(listskel(free)>>listskel(ground), in) is semidet.
%:-mode preffix(listskel(free)>>ground, in) is semidet.

and want use preffix([X,Y], [1,2,3,4]) where X, Y is free.
But this code do not compile.
What mode is necessary for first argument of preffix?
mmc --infer-modes do not infered it.

Similar code on Curry work:

preffix [] _ = success
preffix (x:t) (y:t1) | x =:= y = preffix t t1

goal | preffix [x,y] [1,2,3,4] = (x,y)
  where
    x free
    y free

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