Re: Reentrant Functions
- To: mathgroup at smc.vnet.net
- Subject: [mg29448] Re: [mg29424] Reentrant Functions
- From: BobHanlon at aol.com
- Date: Wed, 20 Jun 2001 04:36:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/6/19 5:41:47 AM, schmitther at netcologne.de writes: >can functions be made reentrant, i.e. can I invoke in a function the >same function again? Yes Clear[fact]; fact[0] = 1; fact[n_Integer?Positive] := n*fact[n-1]; fact[4] == Factorial[4] True This has no memory ??fact If you want it to remember values that it has calculated Clear[fact]; fact[0] = 1; fact[n_Integer?Positive] := fact[n] = n*fact[n-1]; fact[4] == Factorial[4] True ??fact Bob Hanlon Chantilly, VA USA