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,8b89f74f9dcec498 X-Google-Attributes: gid103376,public From: dsmith@clark.net (Doug Smith) Subject: Re: How to do Generic function? Date: 1996/04/18 Message-ID: #1/1 X-Deja-AN: 148230952 references: <4l4h1p$g6v@hatathli.csulb.edu> content-type: TEXT/PLAIN; charset=ISO-8859-1 organization: AdaSmith mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-04-18T00:00:00+00:00 List-Id: 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)