hclang 0.51.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/lib/bundle/hc-sources.js +50 -50
- package/esm/lib/frames/denum-observers.js +71 -108
- package/esm/lib/frames/fourth-hash.js +20 -6
- package/esm/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -2793,67 +2793,67 @@ export const HC_SOURCES = new Map([
|
|
|
2793
2793
|
"```",
|
|
2794
2794
|
"## Geometric observers, `.##%` … `.###%%%`",
|
|
2795
2795
|
"Six observers read a Denum through a geometry (occurrence/figure 007.41b,",
|
|
2796
|
-
"007.41c).
|
|
2797
|
-
"
|
|
2798
|
-
"
|
|
2799
|
-
"
|
|
2800
|
-
"
|
|
2801
|
-
"
|
|
2802
|
-
"
|
|
2803
|
-
"",
|
|
2804
|
-
"
|
|
2805
|
-
"
|
|
2806
|
-
"
|
|
2807
|
-
"
|
|
2808
|
-
"
|
|
2809
|
-
"
|
|
2810
|
-
"
|
|
2811
|
-
"
|
|
2812
|
-
"
|
|
2813
|
-
"
|
|
2796
|
+
"007.41c, 007.43h, 007.43i, 007.44). The Count of the Denum is its rank `r`, and",
|
|
2797
|
+
"each geometry wants a definite number of slots for that rank: the simplex (SSL,",
|
|
2798
|
+
"`%`) `r+1`, the cross-polytope (KPSL, `%%%`) `2r` and the Cayley–Dickson signed",
|
|
2799
|
+
"basis (KDSL, `%%`) `2^r`. The stored loads are aligned to the wanted length:",
|
|
2800
|
+
"missing slots are 0 and excess slots wrap by index modulo the wanted length,",
|
|
2801
|
+
"adding into the slot they wrap to. The observer is the geometry's ordinary",
|
|
2802
|
+
"formula on that virtual array, so every Count has a defined reading under every",
|
|
2803
|
+
"observer, Count zero included. `.#%` is not applied and is unchanged. The `##`",
|
|
2804
|
+
"spelling answers a squared magnitude, exact and nonnegative: a Count when whole",
|
|
2805
|
+
"and a rational otherwise. The `###` spelling answers a fresh list of signed",
|
|
2806
|
+
"coordinates, never a Denum and never a single number. They are observations",
|
|
2807
|
+
"only: no load, native observer or operator changes, and no algebra product is",
|
|
2808
|
+
"installed",
|
|
2809
|
+
"",
|
|
2810
|
+
"The centered simplex, `%`, places the `r+1` slots on the vertices of a regular",
|
|
2811
|
+
"simplex centred at zero. `.##%` is `(C·Σbi² − S²)/(C−1)` with `S = Σbi` and",
|
|
2812
|
+
"`C = r+1`, and `.###%` is the centred coefficients `bi − S/C`, which sum to",
|
|
2813
|
+
"zero. Adding the same amount to every slot changes neither, and rank 0 is the",
|
|
2814
|
+
"degenerate simplex, of magnitude 0",
|
|
2815
|
+
"```",
|
|
2816
|
+
"; .Sd (Denum [2, [2, 5, 3, 7, 4]]);",
|
|
2817
|
+
"; [Sd.##%, Sd.###%, “” Sd]",
|
|
2818
|
+
"# [36, [2, 2, -4], “Denum(2,[2, 5, 3, 7, 4])”]",
|
|
2819
|
+
"; [(Denum [1, [3, 1]]).##%, (Denum [3, [2, 4, 2, 4]]).##%, (Denum [2, [1]]).###%, (Denum [2, [4, 4, 4]]).##%, (Denum [0, [5, 3]]).###%]",
|
|
2814
2820
|
"# [4, 16/3, [2/3, -1/3, -1/3], 0, [0]]",
|
|
2815
2821
|
"```",
|
|
2816
|
-
"The Cayley–Dickson observers, `%%`,
|
|
2817
|
-
"
|
|
2818
|
-
"
|
|
2819
|
-
"
|
|
2820
|
-
"
|
|
2821
|
-
"`
|
|
2822
|
-
"
|
|
2823
|
-
"
|
|
2824
|
-
"
|
|
2825
|
-
"
|
|
2826
|
-
"
|
|
2827
|
-
"
|
|
2828
|
-
"
|
|
2829
|
-
"
|
|
2830
|
-
"
|
|
2831
|
-
"
|
|
2832
|
-
"
|
|
2833
|
-
"
|
|
2834
|
-
"
|
|
2835
|
-
"`b(i+n)` are opposite. `.###%%%` is the antipodal residual `ri = bi − b(i+n)`",
|
|
2836
|
-
"and `.##%%%` is `Σ ri²`, zero exactly when every opposite pair matches. An odd",
|
|
2837
|
-
"Count has no such pairing and is `$!.denum-cross-count`; that refuses only this",
|
|
2838
|
-
"one-load-per-vertex binding, since a cross-polytope exists in every dimension n",
|
|
2839
|
-
"```",
|
|
2840
|
-
"; [(Denum [4, [2, 4, 2, 4]]).###%%%, (Denum [4, [2, 4, 2, 4]]).##%%%, (Denum [6, [5, 2, 3, 5, 1, 3]]).###%%%, (Denum [6, [5, 2, 3, 5, 1, 3]]).##%%%, (Denum [2, [3, 1]]).###%%%]",
|
|
2822
|
+
"The Cayley–Dickson signed-basis observers, `%%`, read `2^r` slots in the",
|
|
2823
|
+
"reference order `+e0 … +e(n−1), −e0 … −e(n−1)` with `n = 2^(r−1)`. `.###%%` is",
|
|
2824
|
+
"`ri = vi − v(i+n)`, i = 0 … n−1, including the real coordinate; at rank 0 it is",
|
|
2825
|
+
"the single value. `.##%%` is `Σ ri²`. Each antipodal pair cancels on its own, so",
|
|
2826
|
+
"the load `[2, 4, 2, 4]` at rank 2 reads `[0, 0]` and `0`, and `[3, 2, 1, 4]`",
|
|
2827
|
+
"reads `[2, -2]` and `8`. Equal magnitudes would not make products agree, and no",
|
|
2828
|
+
"Cayley–Dickson product is installed",
|
|
2829
|
+
"```",
|
|
2830
|
+
"; [(Denum [2, [2, 4, 2, 4]]).###%%, (Denum [2, [2, 4, 2, 4]]).##%%, (Denum [2, [3, 2, 1, 4]]).###%%, (Denum [2, [3, 2, 1, 4]]).##%%]",
|
|
2831
|
+
"# [[0, 0], 0, [2, -2], 8]",
|
|
2832
|
+
"; [(Denum [0, [5, 3, 9]]).###%%, (Denum [1, [5, 3, 9]]).###%%, (Denum [3, [9, 1, 2, 3, 4, 5, 6, 7]]).###%%, (Denum [2, [3, 1]]).##%%]",
|
|
2833
|
+
"# [[17], [11], [5, -4, -4, -4], 10]",
|
|
2834
|
+
"```",
|
|
2835
|
+
"The cross-polytope observers, `%%%`, place `2r` slots on the vertices",
|
|
2836
|
+
"`+e0 … +e(r−1), −e0 … −e(r−1)`, so `bi` and `b(i+r)` are opposite. `.###%%%` is",
|
|
2837
|
+
"the antipodal residual `ri = bi − b(i+r)` and `.##%%%` is `Σ ri²`, zero exactly",
|
|
2838
|
+
"when every opposite pair matches. Rank 0 wants no slots and reads `[]` and 0",
|
|
2839
|
+
"```",
|
|
2840
|
+
"; [(Denum [2, [2, 4, 2, 4]]).###%%%, (Denum [2, [2, 4, 2, 4]]).##%%%, (Denum [3, [5, 2, 3, 5, 1, 3]]).###%%%, (Denum [3, [5, 2, 3, 5, 1, 3]]).##%%%, (Denum [1, [3, 1]]).###%%%]",
|
|
2841
2841
|
"# [[0, 0], 0, [0, 1, 0], 1, [2]]",
|
|
2842
|
-
"; [(Denum [
|
|
2843
|
-
"# [
|
|
2842
|
+
"; [(Denum [0, [1]]).###%%%, (Denum [1, [5]]).##%%%, (Denum [2, [1, 2]]).###%%%]",
|
|
2843
|
+
"# [[], 25, [1, 2]]",
|
|
2844
2844
|
"```",
|
|
2845
|
-
"Only a Denum is observed,
|
|
2846
|
-
"
|
|
2845
|
+
"Only a Denum is observed, and no class can declare an observer of its own. A",
|
|
2846
|
+
"rank whose wanted slots pass the binding capacity of 65536 is refused",
|
|
2847
2847
|
"```",
|
|
2848
|
-
"; [[5, 3].##%, 3.###%%, (Denum [
|
|
2849
|
-
"# [$!.denum-binding-receiver, $!.denum-binding-receiver, $!.denum-binding-
|
|
2848
|
+
"; [[5, 3].##%, 3.###%%, (Denum [70000, [1]]).###%, (Denum [17, [1]]).##%%, [.##% {7}].##%]",
|
|
2849
|
+
"# [$!.denum-binding-receiver, $!.denum-binding-receiver, $!.denum-binding-capacity, $!.denum-binding-capacity, $!.denum-binding-receiver]",
|
|
2850
2850
|
"```",
|
|
2851
2851
|
"Each observer is one token. A longer run, such as `.##%%%%`, is one unbound",
|
|
2852
2852
|
"name, never an observer before a `%`.",
|
|
2853
2853
|
"**Breaking:** `.##%%` and `.###%%` written without a space used to read as",
|
|
2854
2854
|
"`.##` or `.###` before `%%`; write `.## %%` for the modulo",
|
|
2855
2855
|
"```",
|
|
2856
|
-
"; [[5, 3, 1].## %% 2, [5, 3, 1].### %% 2, (Denum [
|
|
2856
|
+
"; [[5, 3, 1].## %% 2, [5, 3, 1].### %% 2, (Denum [1, [3, 1]]).##%.#]",
|
|
2857
2857
|
"# [1, 1, 4]",
|
|
2858
2858
|
"```",
|
|
2859
2859
|
"## Importing",
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Geometric observers of a
|
|
3
|
-
* 007.41c). They read a Denum and answer numbers and
|
|
4
|
-
* native.
|
|
2
|
+
* Geometric observers of a Denum, read by rank (occurrence/figure 007.41b,
|
|
3
|
+
* 007.41c, 007.43h, 007.43i, 007.44). They read a Denum and answer numbers and
|
|
4
|
+
* lists, and change nothing native.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* The Count of the Denum is the rank `r`. Each geometry wants a definite
|
|
7
|
+
* number of slots for that rank, and the Denum's stored loads are aligned to
|
|
8
|
+
* it into a virtual array: missing slots are 0, and excess slots wrap by index
|
|
9
|
+
* modulo the wanted length, their loads adding into the slot they wrap to, as
|
|
10
|
+
* `.#%` folds. The residual is then the geometry's ordinary formula on that
|
|
11
|
+
* virtual array, so every Count has a defined reading under every observer.
|
|
12
|
+
* The Count binding `.#%` itself is unchanged and is not applied here.
|
|
12
13
|
*
|
|
13
|
-
* | Geometry | Size-like | Residual-like |
|
|
14
|
+
* | Geometry | Size-like | Residual-like | Wanted slots |
|
|
14
15
|
* | --- | --- | --- | --- |
|
|
15
|
-
* | centered simplex `%` | `.##%` | `.###%` |
|
|
16
|
-
* |
|
|
17
|
-
* |
|
|
16
|
+
* | centered simplex (SSL) `%` | `.##%` | `.###%` | r + 1 |
|
|
17
|
+
* | cross-polytope (KPSL) `%%%` | `.##%%%` | `.###%%%` | 2r |
|
|
18
|
+
* | Cayley–Dickson signed basis (KDSL) `%%` | `.##%%` | `.###%%` | 2ʳ |
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
20
|
+
* KDSL (007.43h) reads signed basis pairs: at rank 0 the single value, at rank
|
|
21
|
+
* r ≥ 1 the 2^(r−1) differences `vᵢ − v(i+2^(r−1))`. Its Size-like is the sum
|
|
22
|
+
* of their squares. A wanted length past `DENUM_BINDING_CAPACITY` is refused as
|
|
23
|
+
* `$!.denum-binding-capacity`.
|
|
24
|
+
*
|
|
25
|
+
* Return types: a squared magnitude is exact and nonnegative, a FrameCount
|
|
26
|
+
* when whole and a FrameRational otherwise. Coordinates are a fresh array of
|
|
27
|
+
* signed exact numbers, never a Denum. No native observer, operator or Denum
|
|
28
|
+
* load changes, and no algebra product is installed.
|
|
26
29
|
*
|
|
27
30
|
* @module
|
|
28
31
|
*/
|
|
@@ -30,35 +33,18 @@ import { Frame } from "./frame.js";
|
|
|
30
33
|
import { FrameArray } from "./frame-array.js";
|
|
31
34
|
import { FrameCount } from "./frame-count.js";
|
|
32
35
|
import { FrameInt } from "./frame-int.js";
|
|
33
|
-
import { FrameNumber } from "./frame-number.js";
|
|
34
36
|
import { FrameRational } from "./frame-rational.js";
|
|
35
|
-
import {
|
|
37
|
+
import { DENUM_BINDING_CAPACITY, denumState } from "./fourth-hash.js";
|
|
36
38
|
/** An exact nonnegative magnitude: a Count when whole, a rational otherwise. */
|
|
37
39
|
function magnitude(num, den) {
|
|
38
40
|
const value = FrameRational.create(num, den);
|
|
39
41
|
return value instanceof FrameInt ? new FrameCount(value.data) : value;
|
|
40
42
|
}
|
|
41
|
-
/** The exact square root of a nonnegative bigint, or undefined. */
|
|
42
|
-
function exactRoot(value) {
|
|
43
|
-
if (value < 2n)
|
|
44
|
-
return value;
|
|
45
|
-
let root = value;
|
|
46
|
-
let next = (root + 1n) / 2n;
|
|
47
|
-
while (next < root) {
|
|
48
|
-
root = next;
|
|
49
|
-
next = (root + value / root) / 2n;
|
|
50
|
-
}
|
|
51
|
-
return root * root === value ? root : undefined;
|
|
52
|
-
}
|
|
53
43
|
const sum = (values) => values.reduce((total, value) => total + value, 0n);
|
|
54
44
|
/**
|
|
55
|
-
* Centered simplex, `.##%`: `Q_S = (C·Σbᵢ² − S²)/(C−1)` with `S = Σbᵢ`, the
|
|
45
|
+
* Centered simplex (SSL), `.##%`: `Q_S = (C·Σbᵢ² − S²)/(C−1)` with `S = Σbᵢ`, the
|
|
56
46
|
* squared length of `Σbᵢvᵢ` over the C unit vertices of a centered regular
|
|
57
47
|
* simplex. Count 1 is degenerate and answers 0.
|
|
58
|
-
*
|
|
59
|
-
* It is also the Cayley–Dickson norm `.##%%`: the Helmert map φ_C is an
|
|
60
|
-
* isometry, so `N(φ_C(B)) = Σxₖ²` equals this form exactly. The identity is
|
|
61
|
-
* checked by test rather than computed twice.
|
|
62
48
|
*/
|
|
63
49
|
function simplexSize(loads) {
|
|
64
50
|
const c = BigInt(loads.length);
|
|
@@ -80,88 +66,63 @@ function simplexResidual(loads) {
|
|
|
80
66
|
return new FrameArray(loads.map((load) => FrameRational.create(c * load - total, c)));
|
|
81
67
|
}
|
|
82
68
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
function helmertNumerators(loads) {
|
|
87
|
-
const numerators = [];
|
|
88
|
-
let prefix = 0n;
|
|
89
|
-
for (let k = 1; k < loads.length; k++) {
|
|
90
|
-
prefix += loads[k - 1];
|
|
91
|
-
numerators.push(prefix - BigInt(k) * loads[k]);
|
|
92
|
-
}
|
|
93
|
-
return numerators;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Cayley–Dickson, `.###%%`: the coefficients `[0, x₁, …, x(C−1)]` of
|
|
97
|
-
* `x = φ_C(B)` on the basis `e₀ = 1, e₁, …`, with
|
|
98
|
-
* `xₖ = sₖ·√(C/((C−1)k(k+1)))`. Writing `d = (C−1)k(k+1)`, that is
|
|
99
|
-
* `sₖ·√(C·d)/d`, so a coordinate is the exact rational `sₖ·√m/d` when
|
|
100
|
-
* `m = C·d` is a perfect square, and a double otherwise, computed as the
|
|
101
|
-
* 007.41 experiment computes it. The real part is the exact 0. A double past
|
|
102
|
-
* the finite range is refused as `$!.numeric-range .###%%`, though `.##%%` of
|
|
103
|
-
* the same Denum stays exact: the two readings have different ranges by
|
|
104
|
-
* design (007.41e).
|
|
69
|
+
* Cross-polytope (KPSL), 2n slots (007.41b §5.A): the slots sit on the
|
|
70
|
+
* vertices `+e₀ … +e(n−1), −e₀ … −e(n−1)`, so `bᵢ` and `b(i+n)` are opposite,
|
|
71
|
+
* and the antipodal residual is `rᵢ = bᵢ − b(i+n)`, i = 0 … n−1.
|
|
105
72
|
*/
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const scale = c > 1 ? Math.sqrt(c / (c - 1)) : 0;
|
|
110
|
-
for (const [index, s] of helmertNumerators(loads).entries()) {
|
|
111
|
-
const k = BigInt(index + 1);
|
|
112
|
-
const d = BigInt(c - 1) * k * (k + 1n);
|
|
113
|
-
const root = s === 0n ? 0n : exactRoot(BigInt(c) * d);
|
|
114
|
-
if (root !== undefined) {
|
|
115
|
-
coordinates.push(FrameRational.create(s * root, d));
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const kk = index + 1;
|
|
119
|
-
const value = (scale * Number(s)) / Math.sqrt(kk * (kk + 1));
|
|
120
|
-
if (!Number.isFinite(value)) {
|
|
121
|
-
return Frame.error("$!.numeric-range .###%%");
|
|
122
|
-
}
|
|
123
|
-
coordinates.push(new FrameNumber(value));
|
|
124
|
-
}
|
|
125
|
-
return new FrameArray(coordinates);
|
|
73
|
+
function antipodalResidual(slots) {
|
|
74
|
+
const n = slots.length / 2;
|
|
75
|
+
return slots.slice(0, n).map((slot, i) => slot - slots[i + n]);
|
|
126
76
|
}
|
|
127
77
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
78
|
+
* Cayley–Dickson signed basis (KDSL, 007.43h), 2ʳ slots in the reference order
|
|
79
|
+
* `+e₀ … +e(n−1), −e₀ … −e(n−1)`: rank 0 is the single value, and rank r ≥ 1
|
|
80
|
+
* is `Rᵢ = vᵢ − v(i+n)` with n = 2^(r−1). The real coordinate is included.
|
|
131
81
|
*/
|
|
132
|
-
function
|
|
133
|
-
|
|
134
|
-
return loads.slice(0, n).map((load, i) => load - loads[i + n]);
|
|
82
|
+
function signedBasisResidual(slots) {
|
|
83
|
+
return slots.length === 1 ? [slots[0]] : antipodalResidual(slots);
|
|
135
84
|
}
|
|
136
|
-
|
|
137
|
-
const
|
|
85
|
+
const sumSquares = (values) => new FrameCount(sum(values.map((value) => value * value)));
|
|
86
|
+
const integers = (values) => new FrameArray(values.map((value) => new FrameInt(value)));
|
|
138
87
|
/**
|
|
139
88
|
* The geometries by the `%` suffix that follows `##` or `###`. Their keys are
|
|
140
89
|
* `Frame.GEOMETRY_SUFFIXES`, from which `Frame.GEOMETRIC_OBSERVERS` is spelled.
|
|
141
|
-
* Odd C has no antipodal pairing, so `$!.denum-cross-count` refuses only this
|
|
142
|
-
* binding, not odd-dimensional cross-polytopes.
|
|
143
90
|
*/
|
|
144
91
|
export const GEOMETRIES = {
|
|
145
92
|
"%": {
|
|
146
|
-
|
|
93
|
+
wanted: (r) => r + 1n,
|
|
147
94
|
size: simplexSize,
|
|
148
95
|
residual: simplexResidual,
|
|
149
96
|
},
|
|
150
97
|
"%%": {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
98
|
+
// 2ʳ, saturated so a huge rank is refused rather than computed.
|
|
99
|
+
wanted: (r) => r > 64n ? DENUM_BINDING_CAPACITY + 1n : 1n << r,
|
|
100
|
+
size: (slots) => sumSquares(signedBasisResidual(slots)),
|
|
101
|
+
residual: (slots) => integers(signedBasisResidual(slots)),
|
|
154
102
|
},
|
|
155
103
|
"%%%": {
|
|
156
|
-
|
|
157
|
-
size: (
|
|
158
|
-
residual: (
|
|
104
|
+
wanted: (r) => 2n * r,
|
|
105
|
+
size: (slots) => sumSquares(antipodalResidual(slots)),
|
|
106
|
+
residual: (slots) => integers(antipodalResidual(slots)),
|
|
159
107
|
},
|
|
160
108
|
};
|
|
161
109
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
|
|
110
|
+
* Aligns stored loads to a wanted length: shorter is zero-filled, longer wraps
|
|
111
|
+
* by index modulo the wanted length, adding into the slot it wraps to.
|
|
112
|
+
*/
|
|
113
|
+
function align(loads, wanted) {
|
|
114
|
+
const slots = new Array(wanted).fill(0n);
|
|
115
|
+
if (wanted === 0)
|
|
116
|
+
return slots;
|
|
117
|
+
loads.forEach((load, index) => {
|
|
118
|
+
slots[index % wanted] += load;
|
|
119
|
+
});
|
|
120
|
+
return slots;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Answers one geometric observer of a source: recognizes the Denum, takes its
|
|
124
|
+
* Count as the rank, aligns its stored loads to the rank's wanted slots, and
|
|
125
|
+
* reads the virtual array.
|
|
165
126
|
*
|
|
166
127
|
* @param source The observed Frame.
|
|
167
128
|
* @param key One of `Frame.GEOMETRIC_OBSERVERS`.
|
|
@@ -170,12 +131,14 @@ export const GEOMETRIES = {
|
|
|
170
131
|
function observeGeometry(source, key) {
|
|
171
132
|
const residual = key.startsWith("###");
|
|
172
133
|
const geometry = GEOMETRIES[key.slice(residual ? 3 : 2)];
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
175
|
-
return
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
return
|
|
179
|
-
|
|
134
|
+
const state = denumState(source);
|
|
135
|
+
if (state instanceof Frame)
|
|
136
|
+
return state;
|
|
137
|
+
const wanted = geometry.wanted(state.count);
|
|
138
|
+
if (wanted > DENUM_BINDING_CAPACITY) {
|
|
139
|
+
return Frame.error("$!.denum-binding-capacity");
|
|
140
|
+
}
|
|
141
|
+
const slots = align(state.loads, Number(wanted));
|
|
142
|
+
return residual ? geometry.residual(slots) : geometry.size(slots);
|
|
180
143
|
}
|
|
181
144
|
Frame.observeGeometry = observeGeometry;
|
|
@@ -133,15 +133,14 @@ export function bindDenumCount(source) {
|
|
|
133
133
|
return construct(new FrameCount(BigInt(bound.length)), bound.map((load) => new FrameCount(load)));
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
|
-
* The
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* they consume the same genuine binding as `.#%` at no extra cost.
|
|
136
|
+
* The recognized Denum state of `source`, or the error `.#%` answers for a
|
|
137
|
+
* failed or non-Denum receiver. The rank observers (007.43i, 007.44) read this
|
|
138
|
+
* stored Count and the stored loads as they are, without binding.
|
|
140
139
|
*
|
|
141
140
|
* @param source The observed Frame.
|
|
142
|
-
* @returns The
|
|
141
|
+
* @returns The Count and stored loads, or the receiver's error.
|
|
143
142
|
*/
|
|
144
|
-
export function
|
|
143
|
+
export function denumState(source) {
|
|
145
144
|
const failure = source.observationError();
|
|
146
145
|
if (failure)
|
|
147
146
|
return failure;
|
|
@@ -150,6 +149,21 @@ export function boundLoads(source) {
|
|
|
150
149
|
const state = recognizeDenum(source);
|
|
151
150
|
if (!state)
|
|
152
151
|
return Frame.error("$!.denum-binding-receiver");
|
|
152
|
+
return { count: state.count, loads: state.loads };
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The loads of `source.#%`, the C sums `bj = Σ ai` over `i mod C = j`, folded
|
|
156
|
+
* without building the bound Denum, or the binding's error in the order
|
|
157
|
+
* `bindDenumCount` documents. The geometric observers (007.41b) read these, so
|
|
158
|
+
* they consume the same genuine binding as `.#%` at no extra cost.
|
|
159
|
+
*
|
|
160
|
+
* @param source The observed Frame.
|
|
161
|
+
* @returns The C bound loads, or the binding's error.
|
|
162
|
+
*/
|
|
163
|
+
export function boundLoads(source) {
|
|
164
|
+
const state = denumState(source);
|
|
165
|
+
if (state instanceof Frame)
|
|
166
|
+
return state;
|
|
153
167
|
if (state.count === 0n)
|
|
154
168
|
return Frame.error("$!.denum-binding-zero-count");
|
|
155
169
|
if (state.count > DENUM_BINDING_CAPACITY) {
|
package/esm/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.52.0";
|