-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Hi,
On the current version 13.0.3
By running some tests and changing from Array to Matrix, I'm getting an unexpected error.
math.map([1, 8, 27], math.format) //['1', '8', '27']
math.map(math.matrix([1, 8, 27]), math.format) // TypeError: Unexpected type of argument in function format (expected: number or BigNumber or function or Object or bigint or Fraction or string or boolean, actual: Array, index: 1)The source of the issue might be that the array implementation is using applyCallback but the matrix implementation is using maxArgumentCount.
It can be fixed by changing
'Matrix, function': function (x, callback) {
return x.map(callback)
}to
'Matrix, function': (M, callback) => M.create(_map(M.toArray(), callback))But then Matrix.map still has the issue in math.matrix([1, 8, 27]).map(math.format)
Some of the logic of mapping an array and mapping a matrix is repeated but having a few differences. Maybe there is an opportunity to use a single implementation either in Matrix, in Array or making both of them match.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels