[m-dev.] Arithmetic switch construct

Ralph Becket rbeck at microsoft.com
Wed Feb 7 22:08:21 AEDT 2001


Having if-then-else expressions is very handy; however, I've often
thought that having switch expressions would also be useful.

That is, rather than writing something like

	f(X) = Y :-
		( X = cons1, Y = result1
		; X = cons2, Y = result2
		(etc.)
		).

one could write

	f(X) =
		( X = cons1, result1
		; X = cons2, result2
		(etc.)
		).

The syntax suggested is conjectural, but the point is that many
functional languages benefit from having case-expressions.

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 
--------------------------------------------------------------------------
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