Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
One thing that always irks me about the definition of Golf,
A competition to find the shortest (fewest keystrokes) Perl code to solve a given problem.
is how it hinges on the length of the representation of the solution. That's an interesting challenge, obviously, but most of the time I'd be far more interrested in a different challenge:
A competition to find the shortest Perl code in terms of tokens to solve a given problem.

where a token is one thing that represents a single semantic entity: Obviously deciding on precise criteria is more involved - it's obvious that functions and keywords count as one token, variables are harder to grasp since $t and $$t[0]->{x} shouldn't both count as a single token. The clearest rule seems to be that you can use exactly one sigil. Every additional sigil and pair of brackets/curlies counts as another token, but arrows count for naught since they're just syntactical sugar. The index inside the brackets/curlies is an extra token by itself, too (being the simplest form of expression). Finally, all pairing symbols, like the curlies that delimit a BLOCK or the brackets that construct an anonymous array, count as a single token (you can't leave out one of them). Most parens don't count - those that belong to a function call and others are only there for disambiguation and don't alter the meaning (or, the intent) of the code.

Basically, this would be a competition to say something in the fewest words possible, as opposed to the Golf challenge to say something in the fewest letters possible.

What do you think? Would such a competition be interesting? Are there loopholes in the rules, are more rules needed? What should it be named? How many questions can I ask?

Makeshifts last the longest.


In reply to Beyond Golf - reading between the tokens by Aristotle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (7)
    As of 2014-04-17 02:34 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (437 votes), past polls