From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 17 Oct 91 08:59:32 GMT From: mcsun!uknet!ukc!mucs!m1!bevan@uunet.uu.net (Stephen J Bevan) Subject: Re: Hopefully simple question regarding generics Message-ID: List-Id: In article <1991Oct16.085901@lglsun.epfl.ch> gauthier@lglsun.epfl.ch (Michel Ga uthier) writes: [ my question on how to parameterise a sort over the collection deleted ] Bert Laverman replies: [ lists and arrays are too different, so don't even bother ... ] This is quite a good answer. May I add some other remarks? Array sorting algorithms implicitely use array operations, which are not list operations. If you want a general sorting algorithm, you must explicit these as generic parameters, and build as procedures the corresponding actual parameters, one set for arrays, and one set for lists, and (why not?) a set for sequential files if applicable. I realise that using the same function to sort an array collection and a list collection is not a good idea in terms of performance (maybe I should have made this clear in my original post). When I talk about a collection, I mean any object that satisfies a certain interface i.e. it should be parameterised over the type and should provide an indexing operator. I realise that an indexing operator is inefficient for a list, but that is besides the point here. The result of this is not meant to be part of a real program (I don't even have an Ada compiler), it is just something I feel I need to know to understand Ada better. So, can anybody give me an example of how I do the above? Thanks again, Stephen J. Bevan bevan@cs.man.ac.uk