comp.lang.ada
 help / color / mirror / Atom feed
From: mtquinn@hom.net (Michael Quinn)
Subject: Re: How to do Generic function?
Date: 1996/04/19
Date: 1996-04-19T00:00:00+00:00	[thread overview]
Message-ID: <4l8cpf$926@homenet.hom.net> (raw)
In-Reply-To: 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

Yes,  You can create a generic with 2 supplied paramters:

1) a generic fomal type to define your array element type
2) a genric formal function to test for "less than"

Using these two generic parameters you can create a package that will
define your array data types, and your sort function.   Using this
method you may use any data type, as long as you can define an order
that you can test.

Michael T. Quinn
mtquinn@hom.net
   or 
MikeTQuinn@AOL.COM





      parent reply	other threads:[~1996-04-19  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
1996-04-18  0:00 ` Robert Dewar
1996-04-20  0:00   ` Robert Gelb
1996-04-19  0:00 ` Michael Quinn [this message]
replies disabled

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