I've come to the conclusion that code golf can be either good (eg reducing unnecessary operations like assignments) or bad (eg reducing character count of variable names).
It strikes me that better a better metric than character or byte count would be to count the number of tokens in a program, eg:
$number_of_matches = $? ? 3 : 4;
^ ^ ^ ^ ^ ^ ^^
would count the same as:
$n=$??3:4;
^ ^^ ^^^^^
As both have 8 tokens.
This would let us preserve readability but still leave the non-repetitive part of code-golf. This would also have the advantage of leveling the playing field somewhat with languages that tend to prefer longer function names.
Thoughts?
return P*($x*$x+$y*$y)
, then ungolfed means you might sayreturn PI * ($foo * $foo + $bar * $bar)
, but you cannot transform it to the$radius
version; that would be different to (not "the same as") the golfed version. \$\endgroup\$