🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.forth
Article #285

Re: Mutual recursion in Forth

#285
From: liberte
Date: Fri, 14 Mar 1986 23:23
21 lines
1363 bytes
I implemented indirect recursion in Forth once upon a time.
I used a Forward defining word for those routines which would be
used before being fully declared.  At execution time, the forwarded
word would dynamically look up its name in the dictionary for the
most recent version of itself and then replace the reference to the
forward definition to a reference to the most recent version.  Thereafter,
the most recent version is used directly.  

For the "married" functions from "Godel, Escher, Bach", p 137 (assuming
direct recursion is also allowed):

forward m
: f dup 1 - f m - ;
: m dup 1 - m f - ;


Dan LaLiberte
liberte@b.cs.uiuc.edu
liberte@uiuc.csnet
ihnp4!uiucdcs!liberte
Technical Details
Message-ID: <9100007@uiucdcsb>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uiucdcsb!liberte
References: <426@ucbjade.BERKELEY.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site uiucdcsb
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uiucdcsb!liberte
From: liberte@uiucdcsb.CS.UIUC.EDU
Newsgroups: net.lang.forth
Subject: Re: Mutual recursion in Forth
Message-ID: <9100007@uiucdcsb>
Date: Fri, 14-Mar-86 18:23:00 EST
Article-I.D.: uiucdcsb.9100007
Posted: Fri Mar 14 18:23:00 1986
Date-Received: Sun, 16-Mar-86 08:47:10 EST
References: <426@ucbjade.BERKELEY.EDU>
Lines: 21
Nf-ID: #R:ucbjade.BERKELEY.EDU:426:uiucdcsb:9100007:000:684
Nf-From: uiucdcsb.CS.UIUC.EDU!liberte    Mar 14 17:23:00 1986