Some functions / methods assume that if the input is of a certain type the output will be of the same type.
math.matrix([1], 'dense', 'number').map(x=>math.unit(x,'m'))
// results in a DenseMatrix of units of type number
Maybe the dispatch system could also include information on the type that will be returned for a certain input.
math.typed('unit', {
'number, string -> unit': (num, str) => math.unit(num, str)
})
Some functions / methods assume that if the input is of a certain type the output will be of the same type.
Maybe the dispatch system could also include information on the type that will be returned for a certain input.