版博士V2.0程序
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Semiring.js 1.3 KiB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * The `Semiring` class is for types that support an addition and multiplication operation.
  3. *
  4. * Instances must satisfy the following laws:
  5. *
  6. * - Commutative monoid under addition:
  7. * - Associativity: `(a + b) + c <-> a + (b + c)`
  8. * - Identity: `zero + a = a + zero <-> a`
  9. * - Commutative: `a + b <-> b + a`
  10. * - Monoid under multiplication:
  11. * - Associativity: `(a * b) * c <-> a * (b * c)`
  12. * - Identity: `one * a <-> a * one <-> a`
  13. * - Multiplication distributes over addition:
  14. * - Left distributivity: `a * (b + c) <-> (a * b) + (a * c)`
  15. * - Right distributivity: `(a + b) * c <-> (a * c) + (b * c)`
  16. * - Annihilation: `zero * a <-> a * zero <-> zero`
  17. *
  18. * **Note:** The `number` type is not fully law abiding members of this class hierarchy due to the potential
  19. * for arithmetic overflows, and the presence of `NaN` and `Infinity` values. The behaviour is
  20. * unspecified in these cases.
  21. *
  22. * @since 2.0.0
  23. */
  24. import { getSemiring } from './function';
  25. // -------------------------------------------------------------------------------------
  26. // deprecated
  27. // -------------------------------------------------------------------------------------
  28. /**
  29. * Use [`getSemiring`](./function.ts.html#getsemiring) instead.
  30. *
  31. * @category zone of death
  32. * @since 2.0.0
  33. * @deprecated
  34. */
  35. export var getFunctionSemiring = getSemiring;