“Alas for us all! And for all that walk the world in these after-days. For such is the way of it: to find and lose, as it seems to those whose boat is on the running stream.”

– Legolas


I sang of leaves, of leaves of gold, and leaves of gold there grew:
Of wind I sang, a wind there came and in the branches blew.
Beyond the Sun, beyond the Moon, the foam was on the Sea,
And by the strand of Ilmarin there grew a golden Tree.
Beneath the stars of Ever-eve in Eldamar it shone,
In Eldamar beside the walls of Elven Tirion.
There long the golden leaves have grown upon the branching years,
While here beyond the Sundering Seas now fall the Elven-tears.
O Lurien! The Winter comes, the bare and leafless Day;
The leaves are falling in the stream, the River flows away.
O Lurien! Too long I have dwelt upon this Hither Shore
And in a fading crown have twined the golden elanor.
But if of ships I now should sing, what ship would come to me,
What ship would bear me ever back across so wide a Sea?

Ackermann’s function [is] unconditionally guaranteed to overflow any stack you allocate!

This is the definition of Ackermann’s function (written in Ada):

function A(M, N: Natural) return Natural is
begin
    if M = 0 then return N + 1;
    elsif N = 0 then return A(M – 1, 1);
    else return A(M – 1, A(M, N – 1));
end A;

The exercise actually asks to write a program for that function (which is weird because the definition is already a program but it probably for a working one) but I don’t see how I’ll need a working one to get the point.

The else clause kinda does it in already.

Fibonacci can overflow easily of you write it recursively. Ackermann’s looks even more problematic. Actually, make that way more problematic.