[Oberon] Oberon-07, recursion and type extension
Lars
noreply at z505.com
Mon Sep 5 12:52:37 CEST 2016
On Mon, September 5, 2016 4:15 am, Alexander Ilin wrote:
> Hello!
>
>
> 05.09.2016, 12:48, "Lars" <noreply at z505.com>:
>
>> It is certainly a different way of thinking about a problem, but for
>> humans, with our brain size.. is it worth abusing recursion?
>
> Humans have very different brain sizes and structures.
>
Yes, some are good at liberal arts, others are good at sciences and maths
Here are some words from Dijkstra, who doubted Recursion later on..
"When, however, these linguistic exercises give birth to some system of
recursive co-routines, should we not then raise the question, whether such
exercises are not drastic enough, are only half-hearted attempts at
freeing ourselves from the shackles of recursive solutions, which,
perhaps, have dominated the scene already too long? (If the mere
suggestion that recursive solutions may fail to be a cure for all our
problems, don't blame me!)" EWD
"It made me wonder, whether in the last fifteen years since LISP and
ALGOL 60, say we have perhaps over-emphasized recursive solutions, and
have taken the last-in-first-out strategy for choosing c often purely a
matter of convenience, as far as storage management is concerned!" --EWD
Originally, Dijkstra was fond of recursion and said it was rarely used in
the early compilers (Algol related) but a really useful tool.. later he
became skeptical. Quotes are from EWD 456 paper.
PROGRAM Clever;
FUNCTION Recursive(i: INTEGER): INTEGER;
BEGIN
Write(i);
i := i + 1;
IF i <= 6 THEN Result := Recursive(i);
END;
BEGIN
Write('EWD ');
Recursive(4);
Readln;
END.
I find this more convoluted and clever than a simple non recursive
solution. It's almost as if functional programming is a competition to
see how many tricks you can get away with and still get cheered on by your
maths friends, whereas procedural programming seems more like a list of
easy to follow instructions, without the clever tricks in place.
More information about the Oberon
mailing list