From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FROM_ADDR_WS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 21 Sep 92 17:26:52 GMT From: haven.umd.edu!darwin.sura.net!cs.ucf.edu!crigler@ames.arc.nasa.gov (Jame s Crigler) Subject: Re: Pascal type sets in Ada? Message-ID: <1992Sep21.172652.951@cs.ucf.edu> List-Id: In article <1992Sep21.050905.1@cc.utah.edu> eyring@cc.utah.edu writes: >This is a question I have had for some time. >Why doesn't Ada include Pascal type sets? >There must be a reason. Or how does one >do Pascal sets in Ada? Any ideas? >-- >>Bob Witmer I think Booch discusses this (or something simalar) in _Software_Engineering_ In_Ada (my least favorite Ada book). The essence is to create a generic that defines a set to be a BOOLEAN array, then use pragma PACK to lower the space overhead. E. g.: generic type BASE is (<>); package SET_PKG is type SET_TYPE is array (BASE) of BOOLEAN; pragma PACK (SET_TYPE); function "+" (S : SET_TYPE; I : BASE) return SET_TYPE; -- Add a member function "-" (S : SET_TYPE; I : BASE) return SET_TYPE; -- Remove a member function IS_A_SUBSET (S : SET_TYPE; POTENTIAL : SET_TYPE) return BOOLEAN; function IS_A_MEMBER (S : SET_TYPE; I : BASE) return BOOLEAN; ... end SET_PKG; Jim Crigler ---------------------------------------- Guinan is Q's mother.