Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Perl Golf - A proposal for a new section of PerlMonks.org

by johannz (Hermit)
on Aug 30, 2000 at 00:57 UTC ( #30214=monkdiscuss: print w/ replies, xml ) Need Help??

Parts of this post are quotes from Welcome to The Perl Golf Page and are not intended to take credit from the author of said page.)

I would like to propose a new section for PerlMonks.org - Perl Golf. Perl Golf is a competition to find the shortest (fewest keystrokes) Perl code to solve a given problem. This is different from obfuscated perl where you are trying to come up with code that is difficult to understand. Perl Golf is more the demonstration of Laziness. At times, Laziness has been explained as doing more with less. A variation of that is doing the same with less. Perl Golf is the embodyment of this version of Laziness

As an example, a co-worker has this code on his whiteboard:

$x = length +(sort map 1x y===c, keys %h)[-1];

He put this up as a challenge for us to figure out what it did. But he got this from a Perl Golf entry that he had seen. I found it interesting because it reminded me of an alternate syntax for the map statement that I rarely use. There are also a few other techniques that are educational in this little snippet of code.

I think a format similar to that used in the Snippets Section would be good. You enter a title and description of the problem, and a code entry for people to beat. People would reply with hopefully shorter entries. See the links below for more info on how Perl Golf has developed over time.

Comment on Perl Golf - A proposal for a new section of PerlMonks.org
Download Code
RE: Perl Golf - A proposal for a new section of PerlMonks.org
by le (Friar) on Aug 30, 2000 at 01:32 UTC
    Nice idea, I like it....

    Hey, the example golf program thread in clpm was started by a friend of mine... nice to see that. :)

RE: (Perl_Golf_Section++)
by Russ (Deacon) on Aug 30, 2000 at 02:28 UTC
    Yes! I would love to see a Golf section on PM.

    Further proposal: to differentiate the Perl Golf section from the Obfuscated Perl section, we should encourage readability through whitespace. "Score" entries by the number of non-whitespace characters only.

    /me would participate... :-)

    Russ
    Brainbench 'Most Valuable Professional' for Perl

      Careful... whitespace is a character too. Think about regexs, strings, subroutines and other places where white space is important. \S are definately chars and should be counted.
        Ah. You're right. I am, of course, thinking about readability whitespace, not programmatic whitespace...

        This does make it much harder to easily quantify a score for a piece of code. I am mainly trying to prevent Perl Golf from simply becoming another Obfuscated area. Since so much "obfuscated" code is simply normal Perl constructs with one-letter variable names and no whitespace, I'd like to see the Perl Golf section emphasize clever, terse, and readable code, since we already have a section devoted to unreadability.

        Russ
        Brainbench 'Most Valuable Professional' for Perl

RE: Perl Golf - A proposal for a new section of PerlMonks.org
by Adam (Vicar) on Aug 30, 2000 at 03:12 UTC
    Please, don't get me wrong. I like perl golf and can be accused of playing occasionally. In fact, I enjoyed your post and the information it contained (I voted it ++). But I don't think that we need a new section for golf tournaments. I think they way we've been doing it has been great. Most golf games boil down to obfuscation, so there is no reason that golf shouldn't be allowed in that section. Additionally, spontaneous games errupt after someone posts, "How do I make this script better". Usually someone posts a good answer and then people set to a casual game of character hunting. The real problem with making a separate section is that games don't usually start with someone saying, "Shrink this". They start on a whim. Then someone would have to decide what posts (or responses to posts) are really golf and move them. (I am against frequent node moves because it makes it harder for me to find old posts.) You see? A great idea, but not worth the price.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://30214]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2014-09-16 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (13 votes), past polls