Friday 27 July 2007

The Back of Your Head

When I was a child, my mother had two mirrors inside opposing doors of her wardrobe. When you opened both doors at an angle of roughly 90° (facing each other), you could see what the back of your head looked like.

Even more intriguing was the Droste effect that resulted from the recursive bouncing back and forth of light between the mirrors. There were infinitely many me's getting progressively smaller! I also remember staring at my mother's tins of Royal baking powder. Each tin had a picture of an identical, but smaller tin on it. And on this tin, there was a picture of another tin. I remember squinting my eyes to see the picture on this third really tiny tin. Although I could not see it, I was convinced it must there.

These were my first encounters with recursion. I would meet it many times more. For instance, on the cover of Pink Floyd's album Ummagumma. (Apart from repeating, the band members also switch positions in every nested photo.) Of course, recursion is also found in computer science. Here it refers to the practice of defining a function such that its definition contains a call to the same function.

The past week I kept coming across programming problems for which recursion gives an elegant, easy to implement solution. Every time I do, I cannot help giving a little whoop. My colleagues assure me that this is very uncool. After all, we all have seen recursion many times before. I disagree. Every now and again, I think it is good to delight in opening that wardrobe to see what the back of your head looks like. Even if you have seen it many times before.

No comments: