`gcd()` should accept array
I would expect math.gcd([1,2]) to work the same as math.gcd(1,2) however it currently throws "Too few arguments in function gcd (expected: number or BigNumber or Array or Matrix or Fraction or string or boolean, index: 1)"
Yes I can imagine that. There are functions like sum and prod that accept both notations, but so far we only have that for functions that have a variable number of arguments, and not for functions that have a fixed number of 1 or 2 arguments (like gcd). I'm not sure if math.gcd([1,2]) is a signature that we should add, I'm not sure if it really adds value. Do you have use cases for it?
for functions that have a fixed number of 1 or 2 arguments (like gcd).
gcd does seem to accept a variable number of args though
If other fns do it it would be nice to be consistent
Do you have use cases for it?
I don't at the moment, I just noticed it didn't work while working on the chain types. However, I do think that it's best to be as forgiving about what kind of arguments are accepted as possible so that you get that "things just work" feeling
Ahh, wait a second. I forgot that gcd also supports not only two but an variable number of arguments. Yes makes sense to me to add Array/Matrix support for gcd and lcm because of that.
I'm still a bit in doubt on whether it makes sense to add array support to say xgcd(a, b) which does accept only two arguments.
Ahh, wait a second. I forgot that gcd also supports not only two but an variable number of arguments. Yes makes sense to me to add Array/Matrix support for gcd and lcm because of that.
👍🏻
I'm still a bit in doubt on whether it makes sense to add array support to say xgcd(a, b) which does accept only two arguments.
Yes, I agree that if a function only takes 2 args then array support probably wouldn't make sense
👌 then we have a clear plan: functions with a variable number of arguments should support array, functions with a fixed number of variables not.
@MostafaEwis are still working on that? If not, then I'd like to take this as my first contribution here 🚀 cc: @josdejong
@jakubriegel Hi Jakub. No, I'm no longer working on this issue, good luck in fixing it.
Support for Array is published now in v11.7.0