I am becoming more and more annoyed at the ever-increasing number of rules about what is deemed acceptable as inputs and outputs to programs
Here is a compilation of such rules that I found:
- Interpretation of Truthy/Falsy
- Empty string as a truthy value
- Can numeric input/output be in unary?
- Should booleans be allowed where a number is required?
- Is the empty string an acceptable decimal representation of 0?
- Can numeric input/output be in the form of byte values?
- Accepting numeric inputs in mixed decimal and unary bases
To me, there is absolutely no need for all of those posts, for the following reason:
Code golf is about golfing your code, not golfing the input or the output.
- A challenge gives you numbers as input? Then you take a number as input and not something ridiculous like the empty string instead of 0.
- Booleans either exist in your language and you use them, or you use
0
and1
as is historically done, nothing else. - Unary is not the natural representation of numbers in almost all languages, therefore it makes no sense that you can take an input number in unary or return it in unary for said languages, instead of what's natural in said languages (almost always decimal).
- ...
In short, you should take inputs and return outputs as is naturally done in the language you use, and not abuse the format of the input/output because it shortens your code. If your algorithm is shorter on unary numbers, then fine but the conversion from and to decimal goes inside your code, not outside.
Why I think this is important
PPCG is graduating, and is often listed in the Hot Network Questions. We often have discussions e.g. in chat or in comments of "bad challenges" that it is very difficult to enter this community.
I strongly believe those input/output formats deter newcomers from participating in challenges, because, just like for me, the idea of taking as input numbers in unary in a Python program seems completely ridiculous to outsiders.
Getting rid of all this also reduces the number of rules that a newcomer needs to know before posting (which there are a lot of already).
0
and1
as truthy falsy in all languages just because that's what is historically done means some languages would have to write really awkward code, if they simply have different truthy/falsy semantics. \$\endgroup\$