in reply to Re: How am i doing?
in thread How am i doing?
:/tmp$ perl -wE'my $x=0; sub rec { return if ($x++ >= 99); rec()}; rec +()' Deep recursion on subroutine "main::rec" at -e line 1. + # <--- :/tmp$ perl -wE'my $x=0; sub rec { return if ($x++ >= 98); rec()}; rec +()'
It's true that every recursion can be written with a loop (and more importantly vice versa!).
But recursions provide very clean maintainable code for many problems and in my experience rarely exceed the 100 threshold, where the memory load is negligible.
FWIW Larry provided us with goto &sub syntax which allows to (re)call a sub without creating a frame and pushing data on the stack.
Most importantly:
Fibonacci is the schoolbook example for with recursive calls and you are WAYYYYYY OFF the mainstream here.
Even flatearthers might ridicule you as a weird outsider.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How am i doing?
by choroba (Cardinal) on Jul 21, 2025 at 08:07 UTC | |
by LanX (Saint) on Jul 21, 2025 at 10:20 UTC | |
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 | |
| |
Re^3: How am i doing?
by LanX (Saint) on Jul 29, 2025 at 19:25 UTC |