🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.forth
Article #304

Re: Recursion forth

#304
From: J. Peter Alfke
Date: Sun, 04 May 1986 12:20
29 lines
1725 bytes
In FIG-influenced versions of FORTH, each word has a 'smudge' bit in its
header.  This bit is normally off, but is set while the word is in the
process of being defined.  The smudge bit inhibits recognition of the word
in a dictionary search.

The purpose of this is to let you redefine a word and have references to
the word call the old version, i.e.

	: cr  crcount @ 1+ crcount ! cr ;	( keep track of cr's)

To defeat this in special cases (recursion), there's a word called
'smudge' which toggles this bit in the most-recently-defined word.
So:

	: fact   smudge
		...blah blah blah, including calls to fact which are
		   real recursive calls...
	;

All FIG implementations have this, and I don't know how many others.
Check yours and see.  This is one of the many things I figured out by
reading and understanding my way through a complete FIG-FORTH listing
(for the 6502, no less); one of the others is just how the hell
<builds - does> works.
-- 
						--Peter Alfke
"Man, Woman, Child:				  alfke@csvax.caltech.edu
 All Is Up Against the Wall of
 SCIENCE"		--Firesign Theatre
Technical Details
Message-ID: <439@cit-vax.Caltech.Edu>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!husc6!harvard!seismo!ll-xn!cit-vax!alfke
References: <1854@mtgzz.UUCP> <2441@yale.ARPA>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!husc6!harvard!seismo!ll-xn!cit-vax!alfke
From: alfke@cit-vax.Caltech.Edu (J. Peter Alfke)
Newsgroups: net.lang.forth
Subject: Re: Recursion forth
Message-ID: <439@cit-vax.Caltech.Edu>
Date: Sun, 4-May-86 08:20:41 EDT
Article-I.D.: cit-vax.439
Posted: Sun May  4 08:20:41 1986
Date-Received: Tue, 6-May-86 06:08:14 EDT
References: <1854@mtgzz.UUCP> <2441@yale.ARPA>
Reply-To: alfke@cit-vax.UUCP (J. Peter Alfke)
Organization: California Institute of Technology
Lines: 29