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

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-23 16:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found