Golfing (was Re: Chomping and stomping)

On 2/2/06, William J. [email protected] wrote:

code before they post are always willing to indulge in that pastime.
Let me clarify.

  • I don’t mind you golfing on the list/newsgroup.
  • I don’t mind you golfing about this task.

What I do mind is threads that were not intended as golfing threads
being hijacked into a golf contest. If I were the OP and posted a
question, then later saw a new post in the thread stemming from that
question, I’d expect useful input or discussion regarding my question.
I am especially touchy about this when golfing replies are posted in
response to a newbie question. While golf can be fun, we don’t want
the newbie to get the wrong idea that the techniques used in the golf
are representative of how the code should be written.

If you feel the desire to golf, please at least rethread it by
changing (at minimum) the subject line.

Jacob F.

PS. And regarding “those who enjoy programming and who test their code
before they post are always willing to indulge in that pastime”. I
usually check the code I post, you were fortunate to catch me at a
time when my mind was on other things and I was pressed for time.
Since I am not willing to indulge in golf, I must not enjoy
programming then. Dang, and I thought I liked it…

On Feb 2, 2006, at 1:20 PM, Jacob F. wrote:

contest, since those who enjoy programming and who test their
question, I’d expect useful input or discussion regarding my question.
PS. And regarding “those who enjoy programming and who test their code
before they post are always willing to indulge in that pastime”. I
usually check the code I post, you were fortunate to catch me at a
time when my mind was on other things and I was pressed for time.
Since I am not willing to indulge in golf, I must not enjoy
programming then. Dang, and I thought I liked it…

Plus the original poster specifically asked about how to get rid of
$_ in the code, not how to add more of it.

-Ezra

Jacob F. wrote:

contest, since those who enjoy programming and who test their
code before they post are always willing to indulge in that pastime.

Let me clarify.

  • I don’t mind you golfing on the list/newsgroup.
  • I don’t mind you golfing about this task.

What egregious arrogance! Let me clarify. What you mind
doesn’t matter.

What I do mind is threads that were not intended as golfing threads
being hijacked into a golf contest.

I’m a wicked hijacker. I know I am because Mr. Fugal told me so.

                            If I were the OP and posted a

question, then later saw a new post in the thread stemming from that
question, I’d expect useful input or discussion regarding my question.
I am especially touchy about this when golfing replies are posted in
response to a newbie question. While golf can be fun, we don’t want
the newbie to get the wrong idea that the techniques used in the golf
are representative of how the code should be written.

If you didn’t want to mislead the newbie, why did you say:
‘String#chomp! is a “destructive” operation. This means that it acts in
place on its receiver and, in this case, returns nil.’

If you didn’t want to mislead the newbie, why did you post this:

def chomper
xx = gets.chomp
until xx == “qq”
puts “hit me with a squirell!”
xx
end
end

puts chomper

Even if there was a way for the loop to terminate, xx would not
be returned. It has to be moved outside of the loop.
Extremely misleading. Extremely confusing to a newbie.
(Of course, Mr. Fugal doesn’t mind that, since whatever he does
is o.k. with him.) And it was extremely arrogant to post untested
code.

Furthermore, it was extremely rude as well as incredibly arrogant
to assert falsely that my code wouldn’t work correctly when
you had not condescended to test it.

Much better than the above code is:

def chomper
puts “Hit me!” while gets.chomp! != “qq”
$_
end

It is superior in three ways.

  1. It is correct.
  2. It is clearer.
  3. It is shorter.

Naturally, Mr. Fugal’s arrogance compels him to dismiss
my version by using the term “golf”, hoping that you will
assume that “golf” is a Bad Thing.

Newbies, don’t be afraid of $_. Matz didn’t include it in Ruby
in order to tempt the unwary into becoming “evil golfers”.
He included it because it is useful. Of course, Mr. Fugal’s
arrogance leads him to believe that his opinion outweighs
Matz’s.

PS. And regarding “those who enjoy programming and who test their code
before they post are always willing to indulge in that pastime”. I
usually check the code I post, you were fortunate to catch me at a
time when my mind was on other things and I was pressed for time.

Why would that make me fortunate? Oh, I get it now! Seeing a human
make an error is an everyday occurance, but witnessing a goof by a god
is special.

William: pot… kettle… black.

-Ezra

On 2/3/06, William J. [email protected] wrote:

Jacob F. wrote:

Let me clarify.

  • I don’t mind you golfing on the list/newsgroup.
  • I don’t mind you golfing about this task.

What egregious arrogance! Let me clarify. What you mind
doesn’t matter.

I didn’t say it did. I was just clarifying my opinion. When I asked
for no golfing in that thread, it was because in my opinion it was
off-topic for that thread. When you called me on the statement, I
thought I better clarify my opinion, hence I clarified while using
the pronoun “I”. You can discard my opinion and I don’t care. Don’t
call me arrogant, however, for responding to a personal query with a
clarification of my opinion.

What I do mind is threads that were not intended as golfing threads
being hijacked into a golf contest.

I’m a wicked hijacker. I know I am because Mr. Fugal told me so.

I never used the word wicked; please don’t put words in my mouth.
Hijacking a newgroup thread is not evil, wicked or in any way morally
wrong.

place on its receiver and, in this case, returns nil.’
Because I made a mistake. I’m glad that someone caught the mistake and
brought it to light. I have learned from it.

puts chomper

Even if there was a way for the loop to terminate, xx would not
be returned. It has to be moved outside of the loop.
Extremely misleading. Extremely confusing to a newbie.

Because I was focusing on the difference between chomp and chomp!,
about which I was mistake anyways. If you compare that code against
Johns original example you’ll find one difference in one character:
the removal of the !. I made that one change because I believed,
mistakenly, that the difference between chomp and chomp! is what was
breaking my code. After jumping to that premature and mistaken
conclusion, I didn’t take the time to proof the rest of his method. I
apologize for any confusion that may have caused.

And it was extremely arrogant to post untested
code.

No, it wasn’t. It was lazy, yes. It was a mistake, yes. But not
arrogant.

Furthermore, it was extremely rude as well as incredibly arrogant
to assert falsely that my code wouldn’t work correctly when
you had not condescended to test it.

Again, that was based on my incorrect assumption about chomp! always
returning nil. I made a mistake. I apologize. I was not trying to be
rude, just helpful.

  1. It is shorter.
    I would argue point 2, but only due to personal taste. I concede points
    1 and 3.

Naturally, Mr. Fugal’s arrogance compels him to dismiss
my version by using the term “golf”, hoping that you will
assume that “golf” is a Bad Thing.

I did not dismiss your version because I thought it was golf. I
dismissed it because I thought, mistakenly, that is was incorrect. For
that I apologize.

Nor have I said golf is a Bad Thing; witness my clarification to which
you have responded.

Newbies, don’t be afraid of $_. Matz didn’t include it in Ruby
in order to tempt the unwary into becoming “evil golfers”.
He included it because it is useful. Of course, Mr. Fugal’s
arrogance leads him to believe that his opinion outweighs
Matz’s.

I never said golfing was evil. I never said or implied that Matz made
a mistake by including $. I never said or implied that $ is not
useful. And I definitely never said or implied that my opinion
outweighs that of Matz. Please do not attribute views to me that I do
not hold.

I discouraged the use of $_ because I believe it to be less readable
than using a named variable. Indeed, John’s original post asked for a
way to incorporate a variable into his solution in place of the $_.

Jacob F.

Ezra Z. wrote:

William: pot… kettle… black.

Whoa, break out the racial slurs. Someone is gonna find himself in some
pretty hot water!

Well, I guess certain dishes are just asking for it.

_why

On 2/3/06, why the lucky stiff [email protected] wrote:

Ezra Z. wrote:

William: pot… kettle… black.

Whoa, break out the racial slurs. Someone is gonna find himself in some
pretty hot water!

Pardon my breaking in here… but how is that a racial slur? Are you
not familiar with the expression “the pot calling the kettle black”,
do you not know what pots and kettles are, or are you just trying to
be funny?

On 2/3/06, Matthew M. [email protected] wrote:

do you not know what pots and kettles are, or are you just trying to
be funny?

You obviously have yet to know _why. :slight_smile:

(Oh, and _why, nice pun there with the “hot water” comment, I didn’t
get it until this second reading…)

Jacob F.

You obviously have yet to know _why. :slight_smile:

Perhaps… But it irks me to no end (to put it mildly) when someone
starts yelling racism where there is none.

However, if what you’re saying is that it’s a bad pun and I’m just to
dense to recognize it, fine. I’ll go sit back in my corner.

On 2/3/06, Matthew M. [email protected] wrote:

You obviously have yet to know _why. :slight_smile:

Perhaps… But it irks me to no end (to put it mildly) when someone
starts yelling racism where there is none.

No, _why wasn’t actually claiming any real racism; as you theorize
below, it was just a pun.

However, if what you’re saying is that it’s a bad pun and I’m just to
dense to recognize it, fine. I’ll go sit back in my corner.

As I said above, it’s just that you have yet to be exposed to the full
force of that which we call _why. It can take a while – I know it
took me some time – to become accustomed to _why’s brand of humor. If
you don’t believe me, go hang out in #camping for a while. :wink:

No offense intended… come back and play! :slight_smile:

Jacob F.