[mercury-users] Switches and Determinism

Ian MacLarty maclarty at csse.unimelb.edu.au
Mon Sep 11 15:07:59 AEST 2006


On Mon, Sep 11, 2006 at 01:55:11PM +1000, Jonathan Morgan wrote:
> If I have a type like the following type:
> 
> :- type switch_test --->
> 	type1;
> 	type2;
> 	type3.
> 
> Then the following code looks fairly deterministic to me.
> 
> :- func test(switch_test) = int.
> test(S) = Y :-
> 	(
> 		S = type1,
> 		Y = 1
> 	;
> 		(S = type2
> 		; S = type3),
> 		Y = 2
> 	).
> 

This works fine with the latest version of mmc (I just tested it).

Zoltan committed an enhancement to switch detection that handles the
case above some time ago.  That change must not be in the version of mmc
you're using.  What version are you using?

Ian.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list