Ruby hangman

5 views
Skip to first unread message

Markus

unread,
Nov 3, 2009, 1:47:47 AM11/3/09
to pdx...@googlegroups.com
> PS: I like how the term "Python style indentation" and its use
> above should make both Ruby and Python programmers squirm. :)

> PPS: I look forward to your brain-twister for tomorrow's meeting,
> if you have time to prepare one.

Well, if it's squirming you want, how about this:


def _
Empty = ""
__ =~ x
x.empty? ______ !x
end

It let's you write things like:

foo if Empty =~ x

and will match all the things that the methods we were discussing
earlier would (e.g. "", nil, false, [], etc. return true, things like 7,
"Bob's your uncle", [:hope] return false).

See y'all tomorrow evening.

-- Markus


Chuck Vose

unread,
Nov 3, 2009, 11:28:19 AM11/3/09
to pdx...@googlegroups.com
Dunno where I'm failing but I get: SyntaxError: (irb):2: dynamic
constant assignment

Seems to hate Empty = ""

Markus

unread,
Nov 3, 2009, 1:48:56 PM11/3/09
to pdx...@googlegroups.com
> Dunno where I'm failing but I get: SyntaxError: (irb):2: dynamic
> constant assignment
>
> Seems to hate Empty = ""

Sorry if you're pulling my leg and I'm being slow, but in case you
aren't I'll answer it straight: this is a preview of the hangman
challenge for tonight's meeting. The "_"s need to be replaced with
ascii characters for it to work as described. Which ascii characters
though? Aye, there's the rub.

Come to the meeting tonight & find out!

-- Markus

P.S. If you do figure it out early, no pre-game spoilers please. But
you're welcome to come an look smug as you call them out in order of
first occurrence, to the joy of all and sundry.

Chuck Vose

unread,
Nov 3, 2009, 2:19:42 PM11/3/09
to pdx...@googlegroups.com
Ah, thanks man. I wasn't pulling your leg yet. Don't know you well enough yet :P

I'll work on it and see what I can figure out for the meeting. Thanks
Reply all
Reply to author
Forward
0 new messages