It's not a function (at least in this case)
No, it shouldn't be allowed, at least not as a "function".
Your submission is a hashmap, which isn't a function. Last time I checked I couldn't perform primality checking by accessing a hashmap (without hardcoding every number which is disallowed by this loophole).
@Mego stated that python's 'collections.defaultdict
', can perform primality checking, and I'm guessing can add two numbers, and so it fulfills the definition of a function. But the again, python has functions, a hashmap simply is not a function.
Languages which have functions, those functions are the only functions. Anything else is not a function and is viable to abuse.
E.g. If "functions that get called in a different way", were allowed. Well, guess what? I have a solution that's called through eval! Huh,... I also have a function that's called through prompt().split("").map((l,i,a)=><CODE HERE>)
.
So here's my stance:
If it's not a function, it's not a function
Pretty straightforward, eh?
f
would not be a function, it would be a dictionary. Even the syntax used to callf
is not the way a function is called in Python, which would bef(x)
notf[x]
. \$\endgroup\${"a":"b"}.__getitem__
. \$\endgroup\${"a":"b"}
has the correct behavior as the submission for some challenge, it's a bad challenge. \$\endgroup\$