comp.lang.ada
 help / color / mirror / Atom feed
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?
Date: 21 Sep 92 17:26:52 GMT	[thread overview]
Message-ID: <1992Sep21.172652.951@cs.ucf.edu> (raw)

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.

             reply	other threads:[~1992-09-21 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-09-21 17:26 Jame s Crigler [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-09-21 13:03 Pascal type sets in Ada? dog.ee.lbl.gov!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox