Say there's a challenge with two inputs. Can we submit a function signature like this?


Instead of


The function then becomes callable as f(a)(b) instead of f(a,b), if we provide example usage. Is this considered acceptable, or should it be added to "standard loopholes"?

  • 9
    \$\begingroup\$ I'm really tempted to say "morally, no", but I don't have any actual argument against it. \$\endgroup\$
    – Sp3000
    Feb 15, 2016 at 2:23
  • 13
    \$\begingroup\$ It... feels wrong, but I don't know why. >_> \$\endgroup\$
    – Doorknob
    Feb 15, 2016 at 2:27
  • 2
    \$\begingroup\$ It should be fine, but don't think you can write actual code like this... ;) \$\endgroup\$ Feb 15, 2016 at 2:29
  • 1
    \$\begingroup\$ It is only shorter for dyadic functions. \$\endgroup\$
    – Dennis
    Feb 15, 2016 at 2:31
  • 2
    \$\begingroup\$ We don't have any rules against currying, so I don't see why not \$\endgroup\$
    – user45941
    Feb 15, 2016 at 4:10
  • 5
    \$\begingroup\$ Haskell does this all the time, every function has only one argument. So of course it should be allowed for ES6, too. \$\endgroup\$
    – nimi
    Feb 15, 2016 at 7:07
  • 2
    \$\begingroup\$ I've added a corresponding answer to the list of admissible I/O methods so people don't have to know about yet another meta post. \$\endgroup\$ Feb 15, 2016 at 7:49

3 Answers 3


Well, yes.

You just have to specify how to call it in your answer. It's no different than a submission that expects a certain type of input input (command line args vs. STDIN, for example).

  • 2
    \$\begingroup\$ As odd as that kind of function definition feels, I think you're right. \$\endgroup\$
    – Alex A.
    Feb 15, 2016 at 2:26


This is just shifting work to the caller. Taking that to the nth degree, can't you just submit c=>c() to every challenge, explaining that your function needs you to call it with the argument z=>...insert actual code here...?

I don't see any reason why the conventions of function calling in Haskell should affect the conventions of function calling in Javascript.



My reasoning is that the output is wrong.

If the challenge was:

Take two integers a and b and output the sum of a and b.

and your answer was:


then your answer is in the form of a function (a=>...), but the output of this function is another function instead of "the sum of a and b".

  • 4
    \$\begingroup\$ Does it return a function if you call it like f(a)(b)? \$\endgroup\$
    – Alex A.
    Feb 15, 2016 at 3:08
  • 4
    \$\begingroup\$ I disagree. You imply that there is a strict way of calling a javascript function; when the code is used in that way, then of course you'll end up with a function. \$\endgroup\$ Feb 15, 2016 at 3:08
  • 4
    \$\begingroup\$ I disagree. If you know lambda calculus, you know that \xy.xy is the same as \x.\y.xy. (If you don't: basically, chaining functions as a=>b=> is the same as (a,b)=>). \$\endgroup\$ Feb 15, 2016 at 3:16
  • \$\begingroup\$ @AlexA. No, it would return the sum when called like f(a)(b), but note that you are actually calling the outer and the inner function which seemed like processing outside of the solution to me. If your answer is the outer function, I feel like you should only be allowed to call the outer function. \$\endgroup\$
    – user81655
    Feb 15, 2016 at 3:20
  • 1
    \$\begingroup\$ I think calling it like f(a)(b) is reasonable so long as its stated that it should be called that way. \$\endgroup\$
    – Alex A.
    Feb 15, 2016 at 3:21
  • 8
    \$\begingroup\$ As nimi noted in a comment on the question, this would actually disallow function submissions in languages like Haskell for any problem that takes multiple arguments, since any multi-argument function is actually a curried single-argument function there. \$\endgroup\$ Feb 15, 2016 at 7:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .