feat(PocomathInstance): Add use(deps, imp) function for defining signatures
This commit is contained in:
parent
4fdafc751e
commit
2ef0b5b263
@ -1,5 +1,6 @@
|
||||
import {use} from '../core/PocomathInstance.mjs'
|
||||
export {Types} from './Types/bigint.mjs'
|
||||
|
||||
export const add = {
|
||||
'...bigint': [[], addends => addends.reduce((x,y) => x+y, 0n)],
|
||||
'...bigint': use([], addends => addends.reduce((x,y) => x+y, 0n))
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import {use} from '../core/PocomathInstance.mjs'
|
||||
export {Types} from './Types/bigint.mjs'
|
||||
|
||||
export const negate = {bigint: [[], b => -b ]}
|
||||
export const negate = {bigint: use([], b => -b)}
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Core of pocomath: create an instance */
|
||||
import typed from 'typed-function'
|
||||
|
||||
export function use(dependencies, implementation) {
|
||||
return [dependencies, implementation]
|
||||
}
|
||||
|
||||
export default class PocomathInstance {
|
||||
/* Disallowed names for ops; beware, this is slightly non-DRY
|
||||
* in that if a new top-level PocomathInstance method is added, its name
|
||||
|
Loading…
Reference in New Issue
Block a user