This question already has an answer here:
- Default for Code Golf: Input/Output methods 76 answers
Submission formats are always flexible here on PPCG. Named functions, anonymous functions or even full programs that perform IO, are all fine.
Even currying is acceptable, for example, taking arguments as
f(4)(5) rather than
But what about returning a function that returns the result?
Consider the following Python code to find the length of a string:
f = lambda s: s.__len__
I know this is a long way to do it, I'm just trying to give a simple example.
To call this function, one would have to call
f with the string parameter, and then call the result, to get the answer - for example,
Another example is this pseudo-Java lambda to convert an object to a string:
x -> x.toString
If you assigned this to
f, you'd call it with
f(object)(). It's very similar to currying, except that the second call takes no parameter.
My question is - should we allow this as an acceptable output format for PPCG code-golf answers?