nanomath/src/generic/arithmetic.js

9 lines
268 B
JavaScript
Raw Normal View History

import {onType} from '#core/helpers.js'
import {Returns} from '#core/Type.js'
import {Any} from '#core/TypePatterns.js'
export const square = onType(Any, (math, T) => {
const mult = math.multiply.resolve([T, T])
return Returns(mult.returns, a => mult(a, a))
})