Re: Recursive functions



On Apr 1, 9:10 pm, Lauri Alanko <l...@xxxxxx> wrote:
In article <1175456107.493063.221...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,

Bill Pursell <bill.purs...@xxxxxxxxx> wrote:
Because it is totally inappropriate to use a recursive
function to compute the length of a string.

"Totally inappropriate" apparently means here "inefficient on a
typical C implementation". That is certainly true, but not always
crucial. Even the space performance isn't an issue if the lengths of
all argument strings are known to have a reasonable bound.

Efficiency aside, recursion is certainly a natural way of defining the
length of a sequence.

It is a natural way of defining the length of a finite sequence
in a mathematical setting. It is not completely unnatural
to define the length of a finite sequence in terms of recursion
on a computer. However, it IS totally inappropriate to compute
the value using recursion. Totally inappropriate does
not mean "inefficient in a typical C implementation". It
is, rather, a euphimism for "completely boneheaded".

.



Relevant Pages

  • Re: Recursive functions
    ... recursion is certainly a natural way of defining the ... it IS totally inappropriate to compute ... not mean "inefficient in a typical C implementation". ... If I had an actual requirement to print the string ...
    (comp.lang.c)
  • Re: Recursive functions
    ... function to compute the length of a string. ... It is a natural way of defining the length of a finite sequence ... to define the length of a finite sequence in terms of recursion ... it IS totally inappropriate to compute ...
    (comp.lang.c)
  • Re: Recursive functions
    ... function to compute the length of a string. ... "Totally inappropriate" apparently means here "inefficient on a ... recursion is certainly a natural way of defining the ...
    (comp.lang.c)