I know that there probably wouldn't be any reason to use this over some other way of creating a variadic function, but is it semantically possible to define something to do this? For example, it could be called like `sum(1)(2)(3)();`. I attempted to implement it with the following code:

```
function sum(x) {
    return function(y) {
        if (!y) return 0;
        else return x + sum(y);
    };
}

```

However, when called this gives `TypeError: string is not a function`. What would cause this to return a string? When I inspected it more closely, it looked like it was returning the code for the function as a string, which makes no sense to me. That said, I am not extensively familiar with the semantics of intricate JavaScript, so I could be missing some huge concept in it.