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,d275ffeffdf83655 X-Google-Attributes: gid103376,public X-Google-Thread: f5d71,d275ffeffdf83655 X-Google-Attributes: gidf5d71,public X-Google-Thread: 109fba,d275ffeffdf83655 X-Google-Attributes: gid109fba,public X-Google-Thread: 146b77,d275ffeffdf83655 X-Google-Attributes: gid146b77,public From: Marin David Condic Subject: Re: Ada vs C++ vs Java Date: 1999/02/09 Message-ID: <36C04F9C.13D44D2F@pwfl.com>#1/1 X-Deja-AN: 442437287 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <369C1F31.AE5AF7EF@concentric.net> <369DDDC3.FDE09999@sea.ericsson.se> <369e309a.32671759@news.demon.co.uk> <77ledn$eu7$1@remarQ.com> <77pnqc$cgi$1@newnews.global.net.uk> <8p64spq5lo5.fsf@Eng.Sun.COM> <77t3ld$nou$1@nnrp1.dejanews.com> <79ce4s$lfq$1@nnrp1.dejanews.com> <79chc7$ko6@drn.newsguy.com> <79dodb$rhf$1@nnrp1.dejanews.com> <79fm3e$ffs$1@nnrp1.dejanews.com> <79fnce$iv8@drn.newsguy.com> <79grbs$d5u$1@nnrp1.dejanews.com> <36BF8A85.626504AE@linkline.com> Content-Type: text/plain; charset=us-ascii Organization: Pratt & Whitney Mime-Version: 1.0 Reply-To: diespammer@pwfl.com Newsgroups: comp.lang.ada,comp.lang.c++,comp.vxworks,comp.lang.java Date: 1999-02-09T00:00:00+00:00 List-Id: Fredric L. Rice wrote: > > In the C and C++ world, sorts _are_ indeed standardized in some ways. > There is a standard library function called qsort() which takes as an > argument > a pointer to the "payload" function which performs the actual compares of > the > data elements being considered in the sort. > > In the APL world, monadic or diadic elements are extracted from the array > or matrix using an index but the sort symbol is standard. > > Knowing squat about Ada at this point, isn't there something like that in > Ada? There are no standard sort libraries in Ada yet. (Day ain't over, yet!) The provision to do something similar to what you describe has been in Ada since the beginning. Using generic parameters to build a generic sort procedure, you can import the data type of elements to be sorted, the array type that holds the elements and comparison functions for determining order. It would look something like this: generic type Item is private ; type Vector_Type is array (Integer range <>) of Item ; with function "<" ( Left : in Item ; Right : in Item) return Boolean ; procedure Quick_Sort ( Vector : in out Vector_Type) ; -- The rest is left as an exercise for the student... So the capacity to make really nice, easy to use generic libraries full of tools was always available. Initially (back in 83) it was believed that there would be an emerging tool building business, so the standard didn't want to overspecify things and possibly shut out new ideas. The tool business never emerged in any major way, so no "industry standard" libraries of stuff emerged. By the time we got to Ada95, it was realized that in at least a few areas, there ought to be a "standard interface" specified for some packages of utilities - mostly in the area of math functions and strings. That was nice, but IMHO not enough. There could, and should, be some "standard" package specifications for various tools so that even if the compiler vendors don't supply it, the tools can be had from some source and everybody agrees on what they should do and how they should be called. This sort of library is in the works. See: http://www.suffix.com/Ada/SCL/ for more info. Note that for many things you would not call "general purpose tools" - such as bindings to OS libraries, specialized language processing subsystems (ASIS) and similar creatures, there are a wealth of packages available. Its just that not all of them are compiler-vendor-supplied and you may need to fish around a little to get them. MDC -- Marin David Condic Real Time & Embedded Systems, Propulsion Systems Analysis United Technologies, Pratt & Whitney, Large Military Engines M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 Ph: 561.796.8997 Fx: 561.796.4669 ***To reply, remove "bogon" from the domain name.*** "Government is not reason. It is not eloquence. It is a force. Like fire, a dangerous servant and a fearful master." -- George Washington