🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth.mac
Article #34

Re: RECURSION?!?

#34
From: Anthony E Bible
Date: Wed, 16 Dec 1992 15:15
19 lines
938 bytes
In article <1992Dec16.052611.3031@peanut> scrogginstom@bvc.edu (Thomas W. Scroggins) writes:
>I am just starting out using Forth and was wondering if MacForth allows
>recursion and if anyone has examples if it does.
>
>-- 

Tom:
	Yes it does.  Here is an example (factorial -- what else :):

: FACTORIAL  ( n1 -- n2)	\ return n1 factorial
   ?DUP IF  DUP 1-  MYSELF *  ELSE  1  THEN ;


	As you can probably tell, MYSELF invokes the word which is being
compiled, i.e., it recurses.


Regards,
tony
Technical Details
Message-ID: <BzCyDq.Dyp@news.iastate.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!news.iastate.edu!bible
References: <1992Dec16.052611.3031@peanut>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.forth.mac
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!news.iastate.edu!bible
From: bible@iastate.edu (Anthony E Bible)
Subject: Re: RECURSION?!?
Message-ID: <BzCyDq.Dyp@news.iastate.edu>
Sender: news@news.iastate.edu (USENET News System)
Organization: Iowa State University, Ames, IA
References: <1992Dec16.052611.3031@peanut>
Date: Wed, 16 Dec 1992 15:15:24 GMT
Lines: 19