[m-dev.] Arithmetic switch construct
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Feb 7 23:58:19 AEDT 2001
On 07-Feb-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 07-Feb-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> > 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.)
> > ).
>
> Why not write that as
>
> f(cons1) = result1.
> f(cons2) = result1.
Sorry, I mean
f(cons1) = result1.
f(cons2) = result2.
^
of course.
> ?
>
> Perhaps you have a better motivating example? ;-)
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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