comp.lang.ada
 help / color / mirror / Atom feed
From: mcsun!uknet!ukc!mucs!m1!bevan@uunet.uu.net  (Stephen J Bevan)
Subject: Re: Hopefully simple question regarding generics
Date: 17 Oct 91 08:59:32 GMT	[thread overview]
Message-ID: <BEVAN.91Oct17095932@hippo.cs.man.ac.uk> (raw)

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

             reply	other threads:[~1991-10-17  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-10-17  8:59 Stephen J Bevan [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-10-21 18:36 Hopefully simple question regarding generics netnews.upenn.edu!uofs!guinness.cs.uofs.edu!beidler
1991-10-23  8:39 mcsun!hp4nl!gufalet.let.rug.nl!rug4!laverman
replies disabled

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