🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.eiffel
Article #1087

Is there a way to get the effect of Pascal's procedure parameters?

#1087
From: Jimmy Wilkinson
Date: Wed, 27 Jan 1993 23:08
45 lines
1912 bytes
I'd like to be able to do in Eiffel something similar to the following
(fragmentary) Pascal code:

program  demo(....);

type
       PersonRecord = ............
       PersAry = array[...] of PersRec;

var  pa : PersAry;

function DateLess(r1, r2 :PersonRecord) : boolean;
begin
  {Return TRUE is the date field in r1 is LESS than the one in r2;  else
FALSE}
end;

function ZipLess(r1, r2 :PersonRecord) : boolean;
begin
  {Return TRUE is the zip field in r1 is LESS than the one in r2;  else
FALSE}
end;

procedure Sort(var a : PersAry; function Precedes(r1, r2: PersonRecord) :
boolean);
begin
{sort array a according to order established by Precedes}
end;

begin     {main}
  {establish pa and its contents}
  Sort(pa, DateLess);
  {do something with the array sorted into ascending order by date}
  Sort(pa, ZipLess);
  {do something with the array sorted into ascending order by zip code}
end.

I can't find anything that will do this.  Does anyone in this group know
whether it can be done and, if so, how?  Any help will be most
appreciated.

-------------------------------------------------------------
Jimmy Wilkinson             Professor of Computer Science
wilkins@cs.cofc.edu        The College of Charleston
(803) 792-8160              Charleston      SC        29424
Technical Details
Message-ID: <1993Jan27.230808.12959@usceast.cs.scarolina.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!crdgw1!rpi!gatech!udel!bogus.sura.net!opusc!usceast!jimmy.cs.cofc.edu!wilkins

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!crdgw1!rpi!gatech!udel!bogus.sura.net!opusc!usceast!jimmy.cs.cofc.edu!wilkins
From: wilkins@cs.cofc.edu (Jimmy Wilkinson)
Newsgroups: comp.lang.eiffel
Subject: Is there a way to get the effect of Pascal's procedure parameters?
Message-ID: <1993Jan27.230808.12959@usceast.cs.scarolina.edu>
Date: 27 Jan 93 23:08:08 GMT
Sender: usenet@usceast.cs.scarolina.edu (USENET News System)
Organization: The College of Charleston
Lines: 45
X-Xxmessage-Id: <A78C8071F5021105@jimmy.cs.cofc.edu>
X-Xxdate: Wed, 27 Jan 93 18:09:53 GMT
X-Useragent: Nuntius v1.1.1d17