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,955fad43713fdf44 X-Google-Attributes: gid103376,public From: "Theodore E. Dennison" Subject: Re: Data Structures as ADTs (was: NFA to DFA) Date: 1996/05/16 Message-ID: <319B213D.794BDF32@escmail.orl.mmc.com>#1/1 X-Deja-AN: 155115583 references: <4n1its$rtt@news2.h1.usa.pipeline.com> <31973BF5.41C67EA6@avions.aerospatiale.fr> <31987C20.167EB0E7@escmail.orl.mmc.com> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Information Systems mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (X11; I; SunOS 4.1.3_U1 sun4m) Date: 1996-05-16T00:00:00+00:00 List-Id: Matthew Heaney wrote: > > In article <31987C20.167EB0E7@escmail.orl.mmc.com>, "Theodore E. Dennison" > wrote: > > >JEAN CLAUDE GALLO wrote: > >> > >> Boaz Chow wrote: > >> > > >> > do you know how to implement SET adt and the operations in Ada? > >> > > >> > >> generic packages > >> You may found examples of SETS in "Software Components with Ada" > >> (G.Booch). He explain theory of Set algorithm and Ada83 generic packages > > > >give me exactly what I want with one simple type declaration. This > >is because Ada defines the boolean operators AND and OR to work on > >ARRAYS of boolean in a bitwise fashion. So why bother with some fancy > >generic ADT package (that might have bugs)? > > Well, then, why bother with abstraction at all? Why even bother programming > in a language that offers direct support for programmer-defined abstractions? > I suppose I could take this silly argument to the other extreme: Pretend you have convinced me and suggest that all built-in types are useless and that only a moron would use Integer or Natural for array indexes when he could use a generic ADT named Sequential_Bounded_Unmanaged_Incrementable_Mathematical_Intgeral, but I don't really have the energy today. It's not like your SPARC chip knows what a boolean array is. A boolean array IS AN ABSTRACTION. And it is an abstraction that happens to come with all the operations needed of sets. (Hint: this was NOT by accident) If it makes you feel better, here's an abstraction for you: type Set is array (Possibilities) of Boolean; function Union (Left : in Set; Right : in Set) renames "OR"; function Intersection (Left : in Set; Right : in Set) renames "AND"; Have a blast. -- T.E.D. | Work - mailto:dennison@escmail.orl.mmc.com | | Home - mailto:dennison@iag.net | | URL - http://www.iag.net/~dennison |