[m-dev.] Why no automatic initialization?

Peter Schachte schachte at cs.mu.OZ.AU
Thu Mar 9 16:35:51 AEDT 2006


Hi all,

For this bit of code:

	sendmoney(Values):-
	        Vs = [S, E, N, D, M, O, R, Y],
		any_list.map0(between(0,9), Vs),
	        all_different(Vs),
	        fd_exclude_value(S, 0),
	        fd_exclude_value(M, 0),
	        linear_eq(
			[-1, 10, -900, -9000, 1, -90, 91, 1000],
			[ Y, R, O, M, D, N, E, S],
			0),
	        label(Vs),
		Values = map(value, Vs).

I get this error from the Mercury compiler:

	sendmoney.m:030: In clause for `sendmoney(out)':
	sendmoney.m:030:   in argument 2 of functor `[|]/2':
	sendmoney.m:030:  mode error in unification of `V_12' and `list.[E |
	V_13]'.
	sendmoney.m:030:   Variable `V_12' has instantiatedness `free',
	sendmoney.m:030:  term `list.[E | V_13]' has instantiatedness
	`list.'[|]'(
	sendmoney.m:030:     free,
	sendmoney.m:030:     free
	sendmoney.m:030:   )'.

Why didn't the compiler insert a call to the initialization predicate
for each element of this list?  (Line 30 is the Vs = [S, .... line).

-- 
Peter Schachte              In war, the first casualty is truth.
schachte at cs.mu.OZ.AU            -- Aeschylus, ca. 475 BC 
www.cs.mu.oz.au/~schachte/  
Phone: +61 3 8344 1338      
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list