From: dsmith@clark.net (Doug Smith)
Subject: Re: How to do Generic function?
Date: 1996/04/18
Date: 1996-04-18T00:00:00+00:00 [thread overview]
Message-ID: <dsmith-1804961554580001@dsmith-ppp.clark.net> (raw)
In-Reply-To: 4l4h1p$g6v@hatathli.csulb.edu
In article <4l4h1p$g6v@hatathli.csulb.edu>, rgelb@csulb.edu (Robert Gelb) wrote:
> I am trying to create a generic sort function that will accept as input an
> array of integers or strings or floats and output that array sorted. Is
> there a way to do it in ADA?
>
> Thanks in advance,
> Robert
I don't do other people's homework when I can help it. But here is a
challenge:
Implement the following generic and demonstrate a working instantiation:
generic
type Index is (<>); -- Usually an index into an array
with procedure Less_Than (Left, Right : in Index); -- Compares array
elements
with procedure Swap (Left, Right : in Index); -- Swaps array elements
procedure Sort (Starting_At : in Index := Index'First;
Ending_At : in Index := Index'Last);
Doug.
- - - - - - - - - - - - - v - - - - - - - -
Doug Smith | 703-760-0519 (Work)
dsmith@clark.net | 703-742-8662 (Home)
AdaSmith@ACM.org | 703-742-9580 (Fax/Data)
http://www.clark.net/pub/dsmith/ | 168.143.0.120 (NetPhone)
next prev parent reply other threads:[~1996-04-18 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-18 0:00 How to do Generic function? Robert Gelb
1996-04-18 0:00 ` Doug Smith [this message]
1996-04-18 0:00 ` Robert Dewar
1996-04-20 0:00 ` Robert Gelb
1996-04-19 0:00 ` Michael Quinn
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox