Closed light-matters closed 2 months ago
Hm, even if Subtract[1,2,3] works, I cannot find in the docs mention of supporting more than 2 args, or how many it does support. Can you @light-matters ? -> https://reference.wolfram.com/language/ref/Subtract.html
Subtract[1,2,3] doesn't work. I think it only supports binary operations and is converted internally to Plus[x,-y]. I think the problem here is the inconsistent errors.
So if we changed the error message as
- Can't handle more than 2 arguments
+ Can't handle less than one or more than 2 arguments
then it would be fine?
A change in error message might help a littel, but I think my original point was that using 'Subtract doesn't 'fail' with an error, but using '-' does. I'm not sure if this is really a problem, but it's at least strange. Why is it more of a problem when there's an alias?
https://github.com/scicloj/wolframite/pull/123 makes sure that Subtract with incorrect args also fails.
For future decision, I'm separating this from the pull request that was merged.
with ERROR
Note that the error message is not strictly true for the first example.
Here, we see that passing the wrong number of arguments to Wolfram functions does not fail in the way that it would if it was done directly in a Wolfram system. Using a higher-level Wolfram abstraction (-) in the Clojurey way however, does. This may end up being desired behaviour, but using '-' from within Mathematica will only fail if there is nothing else at all in the cell (incomplete expression) and will otherwise work as Subtract or Minus depending on the context.