Re: recursive functions

From: Richard Gration (richard_at_zync.co.uk)
Date: 08/05/04


Date: Thu, 05 Aug 2004 13:30:59 +0100

In article <cercpd$bn1$1@mamenchi.zrz.TU-Berlin.DE>, "Anno Siegel"
<anno4000@lublin.zrz.tu-berlin.de> wrote:
<SNIP>
> In everyday programming, the most frequent question about recursion is
> whether to use it at all. The factorial example teaches the wrong
> decision.

Fair point. Agreed.

> If you want a simple arithmetic example for a naturally recursive
> problem, use Euclid's algorithm.
>
> sub euclid {
> my ( $a, $b) = @_;
> $b ? euclid( $b, $a % $b) : $a;
> }
>

That's beautiful ... noted for future reference

>> computer is not the ideal tool to convert celsius to fahrenheit
either,
>
> Why on earth not?

the overkill factor ... put another way ... (possibly expensive) claptrap ? ;-)

> Would you prefer a slide-rule? It isn't used to its

well, when I wrote the above comment, a long strip of paper with 2
columns of marks with numbers next to them was one tool which came to
mind!

>> yet I have written a few programs to do just that when learning a
>> language. :-)
> You weren't taught to do that recursively, I suppose :)

The mind boggles ... ;-)

Rich