# On GolfScript and language bigotry

I'd like to receive people's opinions on languages "designed for golfing", such as GolfScript and FlogScript. However, since there are no FlogScript submissions on the site as of current writing, this post will focus on GolfScript.

First of all, let's clear a misconception that Nakilon has expressed. GolfScript is not "only for golfing"; it's actually a general-purpose programming language, that just happens to encourage brevity to a more extreme degree than most others. It does not have special cheats or backdoors that allow shortcuts to solving any given golfing problem.

In my personal opinion, I consider GolfScript to be part of Golfing 101, and certainly every "professional" golfer I know of knows how to read GolfScript at the very least, and most know how to write it too; it's not even a hard language to learn. Trying to compete in golf without knowing GolfScript is like trying to read Japanese without knowing kanji.

However, marcog has made a comment, that seems to be echoed by a number of others, that they don't know how to read GolfScript. My personal opinion notwithstanding, there is probably a case for supporting GolfScript-illiterate people to a degree, to level the playing field and broaden the site's appeal.

Of course, I'm strongly against a GolfScript ban. However, if people think it's useful, I'm happy to write commentary that describes how each program works, at least from a bird's eye level. We can even make this a recommendation for other people wanting to post GolfScript submissions (though, to support fastest gun in the west, posts that don't come with an explanation should not be penalised for at least the first day after posting).

I'd love to hear people's thoughts on this.

I don't see how not knowing GolfScript for golf is like trying to read Japanese without knowing Kanji. It's more like trying to street race in a Civic while someone else had the audacity to participate in an F1 car.

No, I doubt there's any explicit rule saying you can't street race in an F1, but you wouldn't be impressing anyone regarding anything other than the fact that you know how to pilot an F1 car. There'll be an implicit handicap regardless of the official winner.

How interesting each answer is in relation to other ones should probably be something that the audience has to decide on a per-question basis, but they should keep in mind that answers should be compared amongst answers written in similar languages as far as brevity and idiomatic features goes.

I don't see any point in banning GS, but I also see no point in up-voting GS answers. Piloting an F1 isn't part of anyone's "street racing 101" course.

• It depends on whether you see knowing GolfScript as an essential part of golfing technique (hence my comparison with kanji). Of course, I think knowing GolfScript (and J, which I have still yet to learn) is essential. I do upvote GolfScript answer if they show useful techniques (and since I know how to read GolfScript, I can tell which answers do). If they're straightforward solutions, I don't bother. – Chris Jester-Young May 1 '11 at 15:56
• Ah, I guess that's where we differ. To me, golfing is more of a game/nerdy social activity than a technical endeavor with practical consequences. To bring up another sports example, it's like sparring with someone of a different weight class. – Rei Miyasaka May 1 '11 at 22:43
• Of course many question will yield interesting answers in the same language simply by virtue of the fact that programs are multiply realizable, and we both agree that answers should be up-voted based on which one is interesting in each language. On the other hand I don't see GS as being essential, because the shortest/most interesting answers in even a verbose language like Java or C# would still be as interesting to me as the most interesting GS answers. – Rei Miyasaka May 1 '11 at 22:50

I once spent an afternoon dabbling with GolfScript and back then I could read it to some degree (wasn't the case after a weekend of J). By now, the only thing I remember is that ; pops the stack which doesn't really help in understanding programs. [Edit: not anymore]

I definitely don't object against GolfScript solutions here. My language of choice isn't the best golfing language but it's fun and that's what it's (to me) about. Similarly, J or APL solutions often are very short compared to other languages, although using a different paradigm than GS.

As an illiterate in such languages I do appreciate some hints about how the program does it and what makes it special but usually I appreciate them for other languages as well. The joy in reading other people's posts is often not about the shortness but rather about the tricks that were used to make it so short.

Of course, then it's saddening that a trivial, straightforward Golfscript solution is still way shorter than anything Ruby, Perl or others offer.

So, generally: A few words about how the solution works are greatly appreciated. Especially for languages as write-only (own opinion) as GolfScript, but not necessarily limited to those.

And definitely no ban of any language. HQ9+ bans itself anyway after three different tasks, so more joke submissions are probably not to be expected there.

• +1 Agree. I'll start annotating my GolfScript submissions with some commentary. :-P – Chris Jester-Young Jan 30 '11 at 15:25
• I've added commentary for the 196 algorithm and Luhn algorithm solutions. Enjoy! :-) – Chris Jester-Young Jan 30 '11 at 17:01
• FOUR different tasks... we haven't seen an "increment the accumulator" golf yet. ;p – KirarinSnow Jan 30 '11 at 19:39
• FWIW, I attempted to post a joke HQ9+ solution (showing that the language has at least 5 uses!) and it was pretty much ignored. – boothby May 19 '12 at 18:21

I would really like to encourage people to post a commented, readable version of their code. Like Timwi does for example, for the more complex pieces of code: one, two, three. Then you don't have to be completely versed in a language and still have a good chance of getting a good idea for how something works.

On SO, I believe that golfscript answers are generally discriminated against by not getting upvotes.

Perl answers that are longer often get 2 or 3 times as many votes.

Personally I think that the perl answers look just as much like line noise as the golfscript, and I don't believe for one minute that all the upvoters have read and understand the code!

I don't think I've had too many downvotes for golfscript though. The answers just seem to be invisible to the majority.

• Many people on SO don't know what a code golf is; they think it's some kind of fancy code challenge without understanding that it's a quest for the shortest code "at any cost". On this site, I fully intend to nip that one in the bud! – Chris Jester-Young Jan 31 '11 at 0:22
• @Chris: I won't vote up solutions that don't at least vaguely understand. A few words about how the solutions works go a long way towards inducing me to vote for solutions in languages I'm not familiar with. (Mind you I don't do lisp but still found your scheme solution to the rpm question comprehensible enough to tick up, so this is a weak condition.) – dmckee --- ex-moderator kitten Jan 31 '11 at 1:24
• @dmckee: +1 Fair point. I actually did annotate a couple of my GolfScript answers, in response to Joey's comment; I do think it helps for GolfScript coders to expand on their answers. (As for Scheme, well, it's hard for me to explain it without sounding like I'm trying to teach Japanese to English speakers, if you know what I mean; my ungolfed version is pretty similar to how a native Scheme coder would write it. So I'm glad you found it readable enough. :-)) – Chris Jester-Young Jan 31 '11 at 1:30
• @dmckee: I wrote some commentary for my Scheme solution now, too. I don't know if this clarifies anything for you, but it may help other readers. – Chris Jester-Young Jan 31 '11 at 1:46
• personally I think that the perl answers look just as much like line noise as the golfscript +1, and they don't look any less so to me when explained. – HostileFork says dont trust SE Apr 10 '14 at 1:26