Guilermo and Tarquin were sitting in Starbucks one day sipping on mocha latte frappucinos like a couple of fruity liberal dandies.
“Hello” said Henrietta, approaching their table with the nonchalant hipster gait of a bisexual art student barista. “Would you like to solve an ill defined mathematical problem for no apparent reason?”
“How will we know when we’re finished?” asked Tarquin.
“You don’t” retorted Guilermo.
“Sounds like my old job.” said Tarquin with an air of bitterness and cynicism that can only be gained from life experience.
Henrietta leaned over the table allowing a more-than-furtive glimpse of those heaving white mountains of flesh in the shapely form of female breasts for no expository reason other than to keep readers with an adolescent reading age hooked in to the story.
“Define a function f : STRING x INTEGER -> STRING which maps the space of all possible input tuples to a modified input string in which the length of no line exceeds the integer parameter. In other words, a line-wrapping function. You would TRY to break lines at word boundaries.”
Guilermo leapt from the table like a nimble fox and rummaged for a moment in his knapsack to produce a netbook which he promptly powered on and began writing a test-suite as a basis for his first solution.
“I always write something first and then try and make it correct at some later date” said Guilermo
“Were you the guy who left before I arrived at my old job?” thought Tarquin.
“Wait a minute,” he said to Henrietta, “couldn’t we just insert a newline for every second character unless the input integer is less than one? In which case return an empty string or loop forever.”
“No,” said Henrietta, “looping forever is not a function. It’s not even an algorithm. But you are right, the problem definition made no mention of maximising line length within the given limit. Let’s just assume I meant to say that.”
Tarquin planted his face in his palm thinking about “you and me and asses.”
At that moment Guilermo announced his first solution – it had passed 100% of a million randomly generated test inputs.
“Sweet” said Tarquin, “but with an infinite input space your confidence interval in the test result is still zero.”
“Yes, any positive integer divided by infinity is always zero. That’s the definition of infinity.”
“That’s some real zen shit” mused Guilermo with a slightly vacant stare on his face.
“I should have become a children’s story writer”
And on that epiphany he went home and dyed his hair purple.
Having sketched a provably correct solution to this simple problem on the napkin after taking 30 seconds to think it through. Tarquin paid the bill, said goodbye to Henrietta and went out cruising for girls with tight pussies and self-esteem issues.
“If you get it right the first time”, he thought, “you have time for good things, like going home to your family or writing the rest of the fucking project.”