Re: request of feature: case statement

From: Kish Shen <ks15_at_icparc.ic.ac.uk>
Date: Sun 22 Dec 2002 06:12:04 PM GMT
Message-Id: <E18QAa4-0001fh-00@holborn.icparc.ic.ac.uk>
Dear Ulrich,

>What is missing is a case statement.  Sometimes you just have 20+ different
>mutually exclusive cases and you want to be sure that one of them is taken

You can do this with the standard Prolog syntax: write a predicate for
the `switch', with each clause representing a case. It is of course up to the
programmer to make sure that the clauses are mutally exclusive, but if you 
are matching atomic terms (which is what most programming languages give
you), then as long as those terms are not repeated in different clauses, you
have mutual exclusiveness. You can also commit to a choice if not mutally
exclusive with cuts (which you will need if you have a `catch all' default
case). 

Cheers,

Kish
Received on Sun Dec 22 17:12:22 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:20 PM GMT GMT