Re: recursive functions
From: Richard Gration (richard_at_zync.co.uk)
Date: 08/05/04
- Next message: Andreas Berg: "Re: How do I detect if I have incoming data in <STDIN> when I pipe something to my perl script ?"
- Previous message: Brian McCauley: "Re: Lookuping IP address using four nameservers at the same time."
- In reply to: Anno Siegel: "Re: recursive functions"
- Next in thread: steve_f: "Re: recursive functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Andreas Berg: "Re: How do I detect if I have incoming data in <STDIN> when I pipe something to my perl script ?"
- Previous message: Brian McCauley: "Re: Lookuping IP address using four nameservers at the same time."
- In reply to: Anno Siegel: "Re: recursive functions"
- Next in thread: steve_f: "Re: recursive functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]