News for hackers. Stuff that matters.
Re:How not to teach recursion (2021) by edflsafoiewq on Saturday June 18, 2022 @03:12PM (#31792816)
Even the basic schoolbook algorithms are recursive

    a * (10*b + c)
  = 10*(a*b) + (a*c)
In fact the usual method is even non-tail recursive, you build up a (literal!) stack of intermediate results which you sum back up at the end.
Re:How not to teach recursion (2021) by lupire on Sunday June 19, 2022 @12:46AM (#31796238)
The usual method is iterative:

for digit in a, for digit in b, multiply digits and offset by sum of indices of digits. The sun results.

Re:How not to teach recursion (2021) by contravariant on Saturday June 18, 2022 @07:43PM (#31794819)
I think most schoolbook algorithms are tail recursive.

They're a bit hard to write down otherwise.