[mercury-users] ....use of solution/2

Ralph Becket rafe at cs.mu.OZ.AU
Mon Mar 22 15:56:50 AEDT 2004

Stefan Hinterstoisser, Monday, 22 March 2004:
> Hi Ralph!
> I just did it as you said, but somehow there is still a mistake in it and i
> dont know where....
> [...]
> main( !IO ) :-
>   io.write_string("Start the Inferenz Program!\n", !IO ),
>   Poss_list = ( solutions( some_sublist( [1,2,3,4] ) ) `with_type` list(int) ),

Your `with_type` assertion is wrong: it should be `list(list(int))', not

You can work this out from the signature of solutions/1: solutions/1
takes a predicate that computes a result of type T and returns the list
of all solutions to that predicate, which of course has type list(T).
In this case T = list(int) so solutions will return a list(list(int)).

The slightly confusing error message you got assumes you meant what you
said when you wrote ``with_type` list(int)'!

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