From 7d95c72f70a7f3a60926c2fe78b2b8c4ca2320f7 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Wed, 2 Apr 2025 03:08:02 +0000 Subject: [PATCH] Update Item Specifications --- Item-Specifications.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Item-Specifications.md b/Item-Specifications.md index 7ae99b9..254ad8d 100644 --- a/Item-Specifications.md +++ b/Item-Specifications.md @@ -75,10 +75,20 @@ Note here that ideally the accesses to `math.config.predictable` and `math.types Looking at how other config properties might work, let's suppose that the `constants` property gives the numeric type that should be used for named constants (e.g., Number or BigNumber). We want `math.tau` to give a scalar entity, but we'd also like to record different possible entities for different types. Since we can't put properties on a number, we use a resolve function directly on the math object that takes the identifier to resolve: ``` -export tau = [ +export const tau = [ [Number], 6.2831853, [BigNumber], math => math.bignumber('6.28318530717958647692'), [], math => math.resolve('tau', [math.config.constants]) ] ``` -A few things to note in this example: now clients of the eventual bundle can use `math.resolve('tau', math.BigNumber)` to get the BigNumber value of tau regardless of the current type in the config.constants setting, the plain `math.tau` should resolve to the correct scalar entity, and the plain `math.tau` should be reset if either config.constants changes or if the setting of math.tau on the type config.constants changes. \ No newline at end of file +A few things to note in this example: now clients of the eventual bundle can use `math.resolve('tau', math.BigNumber)` to get the BigNumber value of tau regardless of the current type in the config.constants setting, the plain `math.tau` should resolve to the correct scalar entity, and the plain `math.tau` should be reset if either config.constants changes or if the setting of math.tau on the type config.constants changes. + +Finally, let's see how the troubling example of absquare in https://code.studioinfinity.org/glen/pocomath/issues/55 would pan out: +``` +export const absquare = [[Complex], (math, [T]) => { + const absq = math.absq.resolve(T.Base) + const add = math.add.resolve(absq.returns, absq.returns) + return Returns(add.returns, z => add(absq(z.re), absq(z.im)) +} +``` +This seems like a success of this scheme to me. Hence, the current plan is to recast the prototype into this format. \ No newline at end of file