Article View: net.lang.forth
Article #307Re: Recursion forth
From: Jeff Bartlett
Date: Tue, 06 May 1986 03:17
Date: Tue, 06 May 1986 03:17
27 lines
1500 bytes
1500 bytes
> In article <1854@mtgzz.UUCP> bds@mtgzz.UUCP (b.d.szablak) writes:
> >
> > I would appreciate it if someone well versed in forth programming
> >could give this novice hints on coding recursive algorthims (the two Forth
> >texts I have manage to avoid this topic). It seems the very first word that
> >I (in all innocence) attempted to define was to evaluate the fibinocci
> >function (in C):
> >
> > fib(n)
> > {
> > if( n==1 || n==2 ) return 1;
> > return fib(n-1) + fib(n-2);
> > }
> >
>
> Regarding recursion in forth: Brodie makes no mention of it in either of the
> two books of his that I've read (_Starting Forth_ and _Thinking Forth_). I've
> heard of a forth implementation somewhere that allowed a word to call itself
> with the special word MYSELF (anyone know where that is?).
I think it is
: MYSELF LATEST PFA CFA , ; IMMEDIATE
Jeff Bartlett
Center for Digital Systems Research
Research Triangle Institute jb!rti-sel@mcnc
Technical Details
Message-ID:
<809@rti-sel.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!mcnc!rti-sel!jbReferences:
<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!linus!philabs!mcnc!rti-sel!jb From: jb@rti-sel.UUCP (Jeff Bartlett) Newsgroups: net.lang.forth Subject: Re: Recursion forth Message-ID: <809@rti-sel.UUCP> Date: Mon, 5-May-86 23:17:29 EDT Article-I.D.: rti-sel.809 Posted: Mon May 5 23:17:29 1986 Date-Received: Thu, 8-May-86 20:13:24 EDT References: <1854@mtgzz.UUCP> <2441@yale.ARPA> Organization: Research Triangle Institute, NC Lines: 27