"As I was going to St. Ives,
I met a man with seven wives.
Each wife had seven sacks,
each sack had seven cats,
each cat had seven kits.
Kits, cats, sacks, wives:
how many were going to St. Ives?"
The programmer says:
"Hrm.
(1..(%w|kits cats sacks wives|).length).inject(0){ |s,n| s +
7**n }
=> 2800
Er, wait, should the man with the wives be included in the count?
Maybe 2795."
"What?" says the woman. "No, the answer is one...you can only be sure
that the person telling the story was going to St. Ives. The man and
his wifes-with-cats posse might not have been going there."
The programmer chuckles.
...
At the next local Ruby users group meeting, the programmer decides to
tell the joke. He announces to the group:
"I have a joke. Er, wait, let me make sure I get this right...
require 'test/unit'
class Foo < Test::Unit::TestCase
def test_answer
answer = tell_joke
assert_equal( 1, answer )
end
end
Eric Hodel wrote:
> On Feb 16, 2007, at 08:15, Phrogz wrote:
>
>> A woman says to her Ruby programmer friend:
>>
>> [...]
>>
>> Unit testing gives away the punchline!
>>
>>
>
> I believe there are two lessons in your story:
>
> You shouldn't write any code without knowing what you're doing.
>
> You shouldn't write any code without knowing when you'll be done.
Corollary 1:
Although some code is a joke - some times even a WTF (also see thedailywtf.com) - not all jokes can be used as code.
Stephan
--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous
On 2/17/07, Stephan Kämper <sigma.kappa@stephankaemper.de> wrote:
> Eric Hodel wrote:
> > On Feb 16, 2007, at 08:15, Phrogz wrote:
> >
> >> A woman says to her Ruby programmer friend:
> >>
> >> [...]
> >>
> >> Unit testing gives away the punchline!
> >>
> >>
> >
> > I believe there are two lessons in your story:
> >
> > You shouldn't write any code without knowing what you're doing.
> >
> > You shouldn't write any code without knowing when you'll be done.
>
> Corollary 1:
>
> Although some code is a joke - some times even a WTF (also see
> thedailywtf.com) - not all jokes can be used as code.
>
>
>
> Stephan
>
Are jokes Turing complete?
Robert
--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous