🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1826

Re: Procedure Variables and Records and Sorting

#1826
From: Chuck Lins
Date: Thu, 21 Mar 1991 18:29
19 lines
1721 bytes
In article <2848.27E71773@puddle.fidonet.org> George.Emery@p0.f6.n105.z1.fidonet.org (George Emery) writes:
>Making use of procedure variables to set the sort method is old hat
>to most folks.  What I'm trying to figure (can it even be done?) is
>a way to allow a procedure to sort different types of records.  Say, for instance, you have several different types of records that happen to have integer values which are meaningful across all the records, but each record type has nothing else in common.  Is there a way to write a generic sort routine?  Or is this too far into object-oriented programming to not be Modula-2?
> 
>GE

The sort routine should be given routines for swapping two elements given an
index as well as routines for comparison and perhaps copying. The procedures
are aware of the different arrays by the sort routine need not be. See 'The
Modula-2 Software Component Library' volume 4, the chapter on sorting.

-- 
Chuck Lins               | "Is this the kind of work you'd like to do?"
Apple Computer, Inc.     | -- Front 242
20525 Mariani Avenue     | Internet:  lins@apple.com
Mail Stop 37-BD          | AppleLink: LINS@applelink.apple.com
Cupertino, CA 95014      | "Self-proclaimed Object Oberon Evangelist"
The intersection of Apple's ideas and my ideas yields the empty set.
Technical Details
Message-ID: <50585@apple.Apple.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!lins
References: <2848.27E71773@puddle.fidonet.org>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!lins
From: lins@Apple.COM (Chuck Lins)
Newsgroups: comp.lang.modula2
Subject: Re: Procedure Variables and Records and Sorting
Message-ID: <50585@apple.Apple.COM>
Date: 21 Mar 91 18:29:36 GMT
References: <2848.27E71773@puddle.fidonet.org>
Organization: Apple Computer Inc., Cupertino, CA
Lines: 19