Skip to Content, Navigation, or Footer.
Thursday, May 2
The Indiana Daily Student

Loops on loops on loops

There’s a neat concept in computer programming called recursion. It’s when a program calls its own name in its definition, essentially running itself repeatedly.

In essence, the program becomes a dog chasing its tail.

Only, this puppy doesn’t get dizzy and keel over. It just does the same thing billions of times with astounding accuracy and no whining. Plus, it doesn’t pee all over the carpet.

But just because we relegate so much of our daily processing needs to computers doesn’t mean loops are absent from our daily lives.

We sit in the middle of class and say, “Well, here I am, again.”

We look down at our gourmet Ballantine Café sandwich and think, “Farmhouse bread, deli turkey, cheddar cheese and lettuce, again.”

We ask the cashier lady, “How are ya?” and then it’s “good-you-oh-not-bad-same-here-have-a-nice-day-you-too” once again.

Some loops aren’t quite as obvious as going to class or taking lunch breaks.

Seeing old friends during the summer reminds you of old times. Watching Bugs Bunny reminds you of sick days as a kid. The smell of roses takes you back to grandma’s funeral.

And the most tantalizing of all: The accidental hearing of Christmas music in July that instantly tricks you into thinking it’s Christmas.

Sensations, memories and conclusions from our daily lives form the basis of even deeper loops: our thoughts themselves.

These range from, “Don’t eat at Taco Bell, the diarrhea is unbearable” to “There is a God!”

In this case, having survived the former is probably what led to the latter.

Computers utilize loops to great benefit. But they would be utterly useless if they didn’t know when to end them. In programming, these loop-terminators are often called “test cases.”

For instance, a program “Add1” may add 1 to a numeric variable called “Sum.” A possible test case for this program would be, “stop adding 1 when Sum equals 12.”

The loop finally ends, “Sum” is returned, and the computer can take a smoke break.

We all tend to forget to implement test cases as we go about our lives. And sometimes we do have the test case, but it’s completely wrong.

For instance, the “McDonald’s” loop, which adds one hamburger to your waistline upon every recursion, may have the faulty test case, “when it tastes good.”

Sometimes we’re just unaware of the test cases and how close our loops have come to them.

The “Purple Drank” loop adds an exciting, rambunctious night to every weekend. But several test cases can end the loop, such as “when you fail out” or “when you wake up in the drunk tank,” and so on.

Our lives are filled with such a variety of loops: the ones we act out, the ones in our minds, the ones that recur every year and the ones that recur every second. It’s up to you harness or break them accordingly.

And never forget that your “Life” loop has a test case, too. When that condition is inevitably met, what “Sum” will you have returned?

­— chagiff@indiana.edu

Get stories like this in your inbox
Subscribe