🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #209

Re: Procedure Problem

#209
From: Dr John Stockton
Date: Mon, 31 Jan 2000 00:00
50 lines
2987 bytes
JRS:  In article <dqmv68.8f1.ln@bastisoft.de> of Sat, 29 Jan 2000
22:41:33 in news:comp.lang.pascal.borland, Sebastian Koppehel
<un0100@bastisoft.de> wrote:
>I agree that crossover recursion can be dangerous, but sometimes it
>makes sense. Whether or not you lose track depends on how clear you
>write the procedures themselves.
>
>My all-time favourite (not intended for actual use):
>
>   function Odd(n : Integer) : Boolean; forward;
>   
>   function Even(n : Integer) : Boolean;
>   begin
>      if n = 0 then Even := true
>      else Even := Odd(n - 1);
>   end;
>   
>   function Odd(n : Integer) : Boolean;
>   begin
>      if n = 0 then Odd := false
>      else Odd := Even(n - 1);
>   end;

Very elegant, as an example possessing crystal clarity combined with no
practical use whatsoever, except maybe to test stack overflow handling.

I am currently polishing a TP7 program - there is already a working
copy, CHEKLINX (PAS (needs VERSION) & EXE), on my WWW site (Sig Line 3)
- which uses mutually recursive procedures.  The program is a relative
links checker for the local DOS master of a WWW site: proc T is given a
presumed file name, and, unless the file has already been done, checks
its existence and if appropriate reads it and calls proc V; V loops
through the links, and, for each, checks the destination from stored
information, calling T if the file is not yet read.  Readers are welcome
to try it, having read the comment starting the PAS.  It also works with
Delphi 3 "DCC32 -cc".

In this case, ISTM that the procedures could have been combined, with a
distinct loss of clarity.

CHEKLINX found several link errors, now fixed, on my site.

FL & others : please see end of Section 1 of c.l.p.b mini-FAQ; NGs re-
ordered.
 
-- 
� John Stockton, Surrey, UK.  jrs@merlyn.demon.co.uk   Turnpike v4.00   MIME. �
 Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
 PAS, EXE in <URL: http://www.merlyn.demon.co.uk/programs/> - see 00index.txt.
 Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)
Technical Details
Message-ID: <InKO18LUHcl4EwT5@merlyn.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <86i06m$hfi$1@news05.btx.dtag.de> <86vk7o$n5i$10@newsg4.svr.pol.co.uk> <dqmv68.8f1.ln@bastisoft.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 108ebd,df7913052dabb237
X-Google-Attributes: gid108ebd,public
X-Google-Thread: 111659,df7913052dabb237
X-Google-Attributes: gid111659,public
From: Dr John Stockton <jrs@merlyn.demon.co.uk>
Subject: Re: Procedure Problem
Date: 2000/01/31
Message-ID: <InKO18LUHcl4EwT5@merlyn.demon.co.uk>
X-Deja-AN: 580025661
Content-Transfer-Encoding: 8bit
X-NNTP-Posting-Host: merlyn.demon.co.uk:158.152.233.145
References: <86i06m$hfi$1@news05.btx.dtag.de> <86vk7o$n5i$10@newsg4.svr.pol.co.uk> <dqmv68.8f1.ln@bastisoft.de>
Content-Type: text/plain;charset=iso-8859-1
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 949349610 nnrp-09:19017 NO-IDENT merlyn.demon.co.uk:158.152.233.145
Organization: Home, 'Surrey', UK
MIME-Version: 1.0
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal