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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC 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: mtquinn@hom.net (Michael Quinn) Subject: Re: How to do Generic function? Date: 1996/04/19 Message-ID: <4l8cpf$926@homenet.hom.net>#1/1 X-Deja-AN: 150335353 references: <4l4h1p$g6v@hatathli.csulb.edu> content-type: text/plain; charset=US-ASCII organization: Caitisys mime-version: 1.0 reply-to: mtquinn@hom.net (Michael Quinn) newsgroups: comp.lang.ada Date: 1996-04-19T00:00:00+00:00 List-Id: 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