Let's say a code-golf challenge is asking for a program without arguments or function without parameters. Are we allowed to take an empty parameter instead we won't use anywhere?
As example: In Java 8+ when we take no input in our lambda we do this:
And when we have a lambda which does take a single input, we do this:
As you can see, the second is one byte shorter than the first. Because of that I created this meta-post with the following question: Are we allowed to use the second (where
null, or any random value at all, which we don't use in the function), when a program/function without arguments is asked?
EDIT: Please note that by unused empty parameter, I indeed mean unused. For example, you could use an empty parameter which you don't use directly in your code, but still use it for it's
static functions, like (where
s->s.join(...), which should be
s->"".join(...) instead. For Java
Void might be useful to use as unused parameter, since it has no additional
Other unused parameters could be used in other languages, as long as they are indeed empty and unused.