in reply to Re^3: How am i doing?
in thread How am i doing?
Yes I'm sure, because I've seen it multiple times used this way, IIRC also in HOP.
The F(n) = F(n-1) + F(n-2) for n > 1 part is straightforwardly implemented with recursion.
> implementing the Fibonacci sequence by recursion is very ineffective.
(Slightly nitpicking) It's inefficient but effective!
The point is you get a correct result, even if you waste processing power.
The "memoisation" you mentioned solves this efficiency problem of needlessly recalculating known results.
IOW, the schoolbook continues evolving the example to deeper depth (sic).
Keep in mind that the classic MIT lectures on programming used to be in Lisp and original Lisp didn't have loops, only those "tail recursions".
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How am i doing?
by hippo (Archbishop) on Jul 21, 2025 at 10:38 UTC | |
by choroba (Cardinal) on Jul 21, 2025 at 11:44 UTC | |
by LanX (Saint) on Jul 21, 2025 at 12:20 UTC | |
by Fletch (Bishop) on Jul 21, 2025 at 13:26 UTC | |
by jaredor (Priest) on Jul 29, 2025 at 19:00 UTC |