Fishing in Ruby

sea =<<END_OF_SEA

<}}}}> ><}}}}> ><}}}}>
<}}}}
>
<}}}}> ><}}}}>
<}}}}*>

END_OF_SEA

fish_caught = sea.scan(%><}}}}*>)
“I got #{fish_caught.size} fish!” # => “I got 7 fish!”

Please don’t overfish.

– Fisherman

Hi –

On Fri, 28 Apr 2006, A Fisherman wrote:

“I got #{fish_caught.size} fish!” # => “I got 7 fish!”
But does it scale?

David


David A. Black ([email protected])
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

“Ruby for Rails” PDF now on sale! http://www.manning.com/black
Paper version coming in early May!

Are you doing this for the halibut? ha!

-A

unknown wrote:

“I got #{fish_caught.size} fish!” # => “I got 7 fish!”
But does it scale?

Now THAT was a groaner if I ever saw one. :wink: hehehe

Pistos

Pistos C. wrote:

A Fisherman wrote:

fish_caught = sea.scan(%><}}}}*>)

Just as I thought: Your code doesn’t run. :wink:

irb(main):088:0> fish_caught = sea.scan(%><}}}}*>)
irb(main):089:1"

This works, though:

fish_caught = sea.scan("><}}}}*>")

/me supposes he’s taking this far too seriously…

IRB can’t handle the fish. It runs reel well using regular ruby command.

so your not fishing off the same platform?

A Fisherman wrote:

fish_caught = sea.scan(%><}}}}*>)

Just as I thought: Your code doesn’t run. :wink:

irb(main):088:0> fish_caught = sea.scan(%><}}}}*>)
irb(main):089:1"

This works, though:

fish_caught = sea.scan("><}}}}*>")

/me supposes he’s taking this far too seriously…

Pistos

On 4/27/06, Daniel B. [email protected] wrote:

To: ruby-talk ML

Posted via http://www.ruby-forum.com/.

I believe he was trolling

pth

Perhaps the original poster was just fishing for compliments.

A Fisherman wrote:

Pistos C. wrote:

fish_caught = sea.scan(%><}}}}*>)
IRB can’t handle the fish. It runs reel well using regular ruby command.

Can someone explain what’s happening with the line, then? Is it using
the ‘>’ as the delimiter? So it’s sort of chopping off the “snout” of
each fish?

Pistos

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs