comp.lang.ada
 help / color / mirror / Atom feed
From: "Theodore E. Dennison" <dennison@escmail.orl.mmc.com>
Subject: Re: Data Structures as ADTs (was: NFA to DFA)
Date: 1996/05/16
Date: 1996-05-16T00:00:00+00:00	[thread overview]
Message-ID: <319B213D.794BDF32@escmail.orl.mmc.com> (raw)
In-Reply-To: mheaney-1605960010060001@news.ni.net


Matthew Heaney wrote:
> 
> In article <31987C20.167EB0E7@escmail.orl.mmc.com>, "Theodore E. Dennison"
> <dennison@escmail.orl.mmc.com> 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         |




  reply	other threads:[~1996-05-16  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-11  0:00 NFA to DFA Boaz Chow
1996-05-13  0:00 ` JEAN CLAUDE GALLO
1996-05-14  0:00   ` Theodore E. Dennison
1996-05-16  0:00     ` Data Structures as ADTs (was: NFA to DFA) Matthew Heaney
1996-05-16  0:00       ` Theodore E. Dennison [this message]
1996-05-14  0:00 ` NFA to DFA Jon S Anthony
1996-05-15  0:00 ` Theodore E. Dennison
1996-05-15  0:00 ` Jon S Anthony
replies disabled

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