# Golfing (was Re: Chomping and stomping)

**URL:** <https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473>\
**Category:** Ruby\
**Created:** [February 2, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473 "2006-02-02T22:21:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 2, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/1 "2006-02-02T22:21:35Z")

</div>

On 2/2/06, William J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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…

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 1:04am UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/2 "2006-02-03T01:04:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 12:29pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/3 "2006-02-03T12:29:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 6:46pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/4 "2006-02-03T18:46:32Z")

</div>

> 

William: pot… kettle… black.

-Ezra

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 6:31pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/5 "2006-02-03T18:31:24Z")

</div>

On 2/3/06, William J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 7:01pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/6 "2006-02-03T19:01:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 7:40pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/7 "2006-02-03T19:40:56Z")

</div>

On 2/3/06, why the lucky stiff [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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?

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 7:46pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/8 "2006-02-03T19:46:58Z")

</div>

On 2/3/06, Matthew M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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. 🙂

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

Jacob F.

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 9:06pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/9 "2006-02-03T21:06:44Z")

</div>

> You obviously have yet to know \_why. 🙂

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.

---

<div class="post-metadata">

**Author:** ![lukfugl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/53a042/32.png) [@lukfugl](https://www.ruby-forum.com/u/lukfugl)\
**Post date:** [February 3, 2006, 9:15pm UTC](https://www.ruby-forum.com/t/golfing-was-re-chomping-and-stomping/100473/10 "2006-02-03T21:15:57Z")

</div>

On 2/3/06, Matthew M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > You obviously have yet to know \_why. 🙂
> 
> 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. 😉

No offense intended… come back and play! 🙂

Jacob F.
