[mercury-users] List instantiation question

doug.auclair at logicaltypes.com doug.auclair at logicaltypes.com
Thu Mar 2 16:42:53 AEDT 2006

Dear all,

I have a list of a known length (a priori) but currently unknown
element values (the /types/ of the elements /are/ known, e.g.: int)
which I am attempting to fill: 

A = 3, B = 7,
Stuff = [_, _, _, _],
populate_stuff(Stuff, A, B).


populate_stuff([], _, _).
populate_stuff([H|T], A, B) :-
  do_something(H, A, B, NewB),
  populate_stuff(T, A, NewB).

The question is: what mode for populate_stuff/3 compiles successfully?
Since Stuff's skeleton is bound it would appear to be a
list_skel_in(?) -- the '?' token is where I am stuck: 'free' makes the
compiler complain that the final instantiatedness of the actual
argument is too ground, but 'bound(int)' fares no better. Mode
'list_skel_out' has similar problems. 

Is this a 'do not do it this way because of inst issues' problem? Is
there some list mode that I am not aware of that solves this issue?

Doug Auclair

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