in reply to Re: Recursive to Iterative using Closures (Fun with Fibonacci)
in thread Recursive to Iterative using Closures (Fun with Fibonacci)
Typical recursion case: When a function requires all elements prior to it to be evaluated before it can be evaluated.
If I work forwards instead of backwards, I can remember what I need to as I go. In the case of the Fibonacci series, I only need the last 2. I was thinking that closures would be an ideal way to "remember" and just move forward from the beginning to the desired element.
This indeed worked, but turned out not requiring the closure at all. So I was left wondering.
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recursive to Iterative using Closures (Fun with Fibonacci)
by Abigail-II (Bishop) on Sep 12, 2003 at 14:33 UTC |