Stuck in an Infinite Loop

(to the tune of "Stuck in the Middle with You", by Joe Egan & Gerry Rafferty)

by John Dougherty, Haverford College Computer Science, Spring 2004

Well, I don't know how I got in this state.

Hey, it seems that I'm a victim of fate,

The loop that I wrote just doesn't work,

Now I'm feeling like an infinite jerk.

Dave to the left of me -- J.D. to the right,

Here I am, stuck in an infinite loop.

Here I am, stuck in an infinite loop.

And I don't know what it is I should do,

The debugger tells me I'm really screwed.

Dave to the left of me -- J.D. to the right,

Here I am, stuck in an infinite loop.

(bridge) Well I started with a precondition

And really thought I had a plan.

The monitor comes over,

"Force-quits" the machine and says,

"SIGABORT -- segmentation fault."

Tried to make some sense of my code,

But it seems I let the logic explode.

I thought I could just experiment,

Next time I'll use an invariant.

Dave to the left of me -- J.D. to the right,

Here I am, stuck in an infinite loop.

(bridge) Well I started with a postcondition

And really thought I had a plan.

The monitor comes over,

Unplugs the machine and says,

"Now it halts -- not my fault."

Well, I don't know how I got here tonite.

The progress condition just wasn't right,

My poor brain is under way too much stress,

Perhaps recursion would have been best.

Dave to the left of me -- J.D. to the right,

Here I am, stuck in an infinite loop.

Here I am, stuck in an infinite loop.

Here I am, stuck in an infinite loop.

Here I am, stuck in an infinite loop ......