Article View: net.lang.forth
Article #311Re: Recursion forth
From: Jeff Bartlett
Date: Fri, 09 May 1986 04:50
Date: Fri, 09 May 1986 04:50
17 lines
1216 bytes
1216 bytes
> : fib ( n ) DUP 3 < IF DROP 1 ( return 1 for 1 or 2, assumes n>=1 )
> ELSE [ SMUDGE ] ( allow for recursion )
> DUP 1- fib ( here is your fib{n-1} )
> SWAP 2- fib ( followed by fib{n-2} )
> + [ SMUDGE ] ( sum two fib s, end recursability )
> THEN ;
If you the SMUDGE method make sure that there is a matching pair (as above).
I believe Fig-Forth SMUDGE toggles the smudge (visability) bit.
The ';' defining word will flip the bit also, so watch-out or you may
end up with an 'invisible' word.
Jeff Bartlett
Center for Digital Systems Research
Research Triangle Institute rti-sel!jb@mcnc
Technical Details
Message-ID:
<811@rti-sel.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!mcnc!rti-sel!jbReferences:
<1854@mtgzz.UUCP> <680@nicmad.UUCP>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: <811@rti-sel.UUCP> Date: Fri, 9-May-86 00:50:07 EDT Article-I.D.: rti-sel.811 Posted: Fri May 9 00:50:07 1986 Date-Received: Sun, 11-May-86 01:08:46 EDT References: <1854@mtgzz.UUCP> <680@nicmad.UUCP> Organization: Research Triangle Institute, NC Lines: 17