From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Expressive Case Statements (was: Software landmines) Date: 1998/09/02 Message-ID: <6sia2o$7eg@sjx-ixn3.ix.netcom.com>#1/1 X-Deja-AN: 386994181 References: <6shit4$eaj@dfw-ixnews5.ix.netcom.com> Organization: ICGNetcom X-NETCOM-Date: Tue Sep 01 7:21:12 PM PDT 1998 Newsgroups: comp.lang.ada Date: 1998-09-01T19:21:12-07:00 List-Id: In article , stt@houdini.camb.inmet.com (Tucker Taft) wrote: >Richard D Riehle (laoXhai@ix.netcom.com) wrote: [snipped away Richard's lengthy posting with the problem] >What about: > type Cond_Array is array(Positive range <>) of Boolean; > ... > declare > Conds : constant Cond_Array := > (condition-1, condition-2, condition-3); > begin > if Conds = (true, true, false) then > ... > elsif Conds = (true, false, false) then > ... > elsif Conds = (false, false, true) then > ... > end if; > end; > >This certainly seems close enough, and captures the decision table >nature of the solution. This doesn't use any "fancy" Ada 95 features. >In fact, it doesn't use any Ada 95 features at all! Now the problem is formulating the actual conditions. As you know, in the decision table there is the condition stub, in which we formulate conditions such as A > B, Z = C, etc. The rule stub where we specify the T, T, F, etc, the action stub where we specify the possible set of actions, and the Rule Actions where we can indicate which actions corrspond to which rules. The solution you show is a good start. I still need a more generalized model for the condition stub. Perhaps this is simply a set of functions that return Boolean results mapped to the array of booleans. This seems easier to state than to convert into a generalized model. Then again, it may be that I am, 1) too close to the way it is solved in another language, 2) so obtuse that it its simplicity does not jump right out at me, or 3) both 1 and 2. I will look this over more closely and see if I can turn it into a generalized solution that corresponds to what I am seeking. Thanks for your input, Tucker. You do have a way of helping us set out on a more interesting path of discovery. Richard Riehle richard@adaworks.com http://www.adaworks.com