hclang 0.20.3 → 0.21.1
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 +113 -15
- package/esm/lib/execute/hc-eval.js +4 -3
- package/esm/lib/execute/syntax.js +1 -1
- package/esm/lib/frames/context.js +3 -2
- package/esm/lib/frames/frame-array.js +3 -0
- package/esm/lib/frames/frame-blob.js +2 -2
- package/esm/lib/frames/frame-count.js +71 -0
- package/esm/lib/frames/frame-decimal.js +2 -2
- package/esm/lib/frames/frame-group.js +3 -0
- package/esm/lib/frames/frame-int.js +25 -34
- package/esm/lib/frames/frame-list.js +37 -0
- package/esm/lib/frames/frame-name.js +9 -0
- package/esm/lib/frames/frame-number.js +2 -2
- package/esm/lib/frames/frame-numeric.js +30 -13
- package/esm/lib/frames/frame-rational.js +3 -2
- package/esm/lib/frames/frame-resource.js +3 -3
- package/esm/lib/frames/frame-schema.js +3 -0
- package/esm/lib/frames/frame-symbol.js +7 -0
- package/esm/lib/frames/frame.js +25 -0
- package/esm/lib/frames/schema-matcher.js +3 -0
- package/esm/lib/frames.js +2 -1
- package/esm/lib/ops/conditionals.js +2 -1
- package/esm/lib/ops/iterators.js +4 -1
- package/esm/lib/ops/math.js +3 -1
- package/esm/lib/ops/type-operations.js +5 -1
- package/esm/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -616,6 +616,21 @@ export const HC_SOURCES = new Map([
|
|
|
616
616
|
"; [.a 1] & {_}",
|
|
617
617
|
"# []",
|
|
618
618
|
"```",
|
|
619
|
+
"`.#` and `.##` count the elements too, the immediate ones and the leaves below",
|
|
620
|
+
"them, so neither counts a property. Every aggregate counts this way, a group as",
|
|
621
|
+
"well as an array. A count is its own size, and any other value has none (#411)",
|
|
622
|
+
"```",
|
|
623
|
+
"; [.meta 1; 2, 3] .#",
|
|
624
|
+
"# 2",
|
|
625
|
+
"; [.meta [1, 2]; [3, []], 4] .##",
|
|
626
|
+
"# 2",
|
|
627
|
+
"; (1, [2, 3]) .##",
|
|
628
|
+
"# 3",
|
|
629
|
+
"; 5.#",
|
|
630
|
+
"# 5",
|
|
631
|
+
"; “abc”.#",
|
|
632
|
+
"# ()",
|
|
633
|
+
"```",
|
|
619
634
|
"**Decision.** Canonical rendering puts the properties first, then the elements.",
|
|
620
635
|
"This reverses the spelling this file carried before. It makes print order agree",
|
|
621
636
|
"with the order the doubled operators iterate, and it leaves canonical output",
|
|
@@ -1745,7 +1760,7 @@ export const HC_SOURCES = new Map([
|
|
|
1745
1760
|
"; 3.%%2",
|
|
1746
1761
|
"# 1",
|
|
1747
1762
|
"; 3.0 %% 2",
|
|
1748
|
-
"# $!.numeric-domain %% FrameDecimal
|
|
1763
|
+
"# $!.numeric-domain %% FrameDecimal FrameCount",
|
|
1749
1764
|
"```",
|
|
1750
1765
|
"Zero and unsupported domains return stable errors",
|
|
1751
1766
|
"```",
|
|
@@ -1754,9 +1769,9 @@ export const HC_SOURCES = new Map([
|
|
|
1754
1769
|
"; 1 %% (1 - 1)",
|
|
1755
1770
|
"# $!.modulo-by-zero %%",
|
|
1756
1771
|
"; 1.408.555 + 1",
|
|
1757
|
-
"# $!.numeric-domain + FrameSequence
|
|
1772
|
+
"# $!.numeric-domain + FrameSequence FrameCount",
|
|
1758
1773
|
"; 1.408.555.< 2",
|
|
1759
|
-
"# $!.numeric-domain < FrameSequence
|
|
1774
|
+
"# $!.numeric-domain < FrameSequence FrameCount",
|
|
1760
1775
|
"; 1.408.555 = 1",
|
|
1761
1776
|
"# ()",
|
|
1762
1777
|
"; -1.408.555",
|
|
@@ -1771,7 +1786,90 @@ export const HC_SOURCES = new Map([
|
|
|
1771
1786
|
"; 65537“x”",
|
|
1772
1787
|
"# $!.repetition-limit 65536",
|
|
1773
1788
|
"; 2 ** 1000000",
|
|
1774
|
-
"# $!.numeric-range **
|
|
1789
|
+
"# $!.numeric-range ** FrameCount",
|
|
1790
|
+
"```",
|
|
1791
|
+
"Counts (#407). Every nonnegative integer literal is a `FrameCount`, the root of",
|
|
1792
|
+
"the ladder, and prints as the same integer does. A sequence's refusal names the",
|
|
1793
|
+
"class of its other operand, which is how these examples observe the rung",
|
|
1794
|
+
"```",
|
|
1795
|
+
"; 1.408.555 + 0",
|
|
1796
|
+
"# $!.numeric-domain + FrameSequence FrameCount",
|
|
1797
|
+
"; 1.408.555 + 1234567890",
|
|
1798
|
+
"# $!.numeric-domain + FrameSequence FrameCount",
|
|
1799
|
+
"; 1.408.555 + -1",
|
|
1800
|
+
"# $!.numeric-domain + FrameSequence FrameInt",
|
|
1801
|
+
"```",
|
|
1802
|
+
"Counts are closed under `+`, `*`, `%%`, and a nonnegative integral `**`",
|
|
1803
|
+
"```",
|
|
1804
|
+
"; 1.408.555 + (2 + 3)",
|
|
1805
|
+
"# $!.numeric-domain + FrameSequence FrameCount",
|
|
1806
|
+
"; 1.408.555 + (2 3)",
|
|
1807
|
+
"# $!.numeric-domain + FrameSequence FrameCount",
|
|
1808
|
+
"; 1.408.555 + (7 %% 3)",
|
|
1809
|
+
"# $!.numeric-domain + FrameSequence FrameCount",
|
|
1810
|
+
"; 1.408.555 + (2 ** 3)",
|
|
1811
|
+
"# $!.numeric-domain + FrameSequence FrameCount",
|
|
1812
|
+
"```",
|
|
1813
|
+
"Negation and subtraction answer `FrameInt` whatever the sign of the result, and",
|
|
1814
|
+
"division answers a ratio, which collapses to `FrameInt` when it is whole",
|
|
1815
|
+
"```",
|
|
1816
|
+
"; 5 - 3",
|
|
1817
|
+
"# 2",
|
|
1818
|
+
"; 1.408.555 + (5 - 3)",
|
|
1819
|
+
"# $!.numeric-domain + FrameSequence FrameInt",
|
|
1820
|
+
"; 1.408.555 + -0",
|
|
1821
|
+
"# $!.numeric-domain + FrameSequence FrameInt",
|
|
1822
|
+
"; 1.408.555 + (6 / 3)",
|
|
1823
|
+
"# $!.numeric-domain + FrameSequence FrameInt",
|
|
1824
|
+
"; 7 / 2",
|
|
1825
|
+
"# 7/2",
|
|
1826
|
+
"```",
|
|
1827
|
+
"Mixed operands follow the ladder",
|
|
1828
|
+
"```",
|
|
1829
|
+
"; 1.408.555 + (2 + (0 - 3))",
|
|
1830
|
+
"# $!.numeric-domain + FrameSequence FrameInt",
|
|
1831
|
+
"; 1.408.555 + (2 * 1.5)",
|
|
1832
|
+
"# $!.numeric-domain + FrameSequence FrameDecimal",
|
|
1833
|
+
"; 7 %% (0 - 3)",
|
|
1834
|
+
"# -2",
|
|
1835
|
+
"```",
|
|
1836
|
+
"Comparison and `=` compare values across rungs, so a count and a FrameInt of the",
|
|
1837
|
+
"same value are `=`. `==`, `===` and `~~` compare exact types, so the two are",
|
|
1838
|
+
"not `==`, just as `2` and `2.0` are not",
|
|
1839
|
+
"```",
|
|
1840
|
+
"; 2 = (5 - 3)",
|
|
1841
|
+
"# <>",
|
|
1842
|
+
"; (5 - 3) = 2",
|
|
1843
|
+
"# <>",
|
|
1844
|
+
"; 2 == (5 - 3)",
|
|
1845
|
+
"# ()",
|
|
1846
|
+
"; (5 - 3) == 2",
|
|
1847
|
+
"# ()",
|
|
1848
|
+
"; 2 === (5 - 3)",
|
|
1849
|
+
"# ()",
|
|
1850
|
+
"; 2 == 2.0",
|
|
1851
|
+
"# ()",
|
|
1852
|
+
"; ~~2 (5 - 3)",
|
|
1853
|
+
"# $!.type-error ~~2 2",
|
|
1854
|
+
"; ~~(5 - 3) 2",
|
|
1855
|
+
"# $!.type-error ~~2 2",
|
|
1856
|
+
"; (0 - 1).< 0",
|
|
1857
|
+
"# <>",
|
|
1858
|
+
"; 2.<= (5 - 3)",
|
|
1859
|
+
"# <>",
|
|
1860
|
+
"; 2.< 2.5",
|
|
1861
|
+
"# <>",
|
|
1862
|
+
"```",
|
|
1863
|
+
"Within one rung, `==` and `~~` hold as they always have",
|
|
1864
|
+
"```",
|
|
1865
|
+
"; 2 == (1 + 1)",
|
|
1866
|
+
"# <>",
|
|
1867
|
+
"; (5 - 3) == (4 - 2)",
|
|
1868
|
+
"# <>",
|
|
1869
|
+
"; ~~2 3",
|
|
1870
|
+
"# 3",
|
|
1871
|
+
"; ~~(0 - 1) (0 - 5)",
|
|
1872
|
+
"# -5",
|
|
1775
1873
|
"",
|
|
1776
1874
|
].join("\n"),
|
|
1777
1875
|
],
|
|
@@ -2240,11 +2338,11 @@ export const HC_SOURCES = new Map([
|
|
|
2240
2338
|
"; %2026-08-21T00:00:00Z% + %2026-08-21T00:00:00Z%",
|
|
2241
2339
|
"# $!.numeric-domain + FrameDateTime FrameDateTime",
|
|
2242
2340
|
"; %2026-08-21% * 2",
|
|
2243
|
-
"# $!.numeric-domain * FrameDateTime
|
|
2341
|
+
"# $!.numeric-domain * FrameDateTime FrameCount",
|
|
2244
2342
|
"; %PT1H% + 1",
|
|
2245
|
-
"# $!.numeric-domain + FrameDuration
|
|
2343
|
+
"# $!.numeric-domain + FrameDuration FrameCount",
|
|
2246
2344
|
"; 1 + %PT1H%",
|
|
2247
|
-
"# $!.numeric-domain +
|
|
2345
|
+
"# $!.numeric-domain + FrameCount FrameDuration",
|
|
2248
2346
|
"```",
|
|
2249
2347
|
"Division follows the same table: an interval over a scalar is an interval, and an",
|
|
2250
2348
|
"interval over an interval is the plain number relating them",
|
|
@@ -2262,7 +2360,7 @@ export const HC_SOURCES = new Map([
|
|
|
2262
2360
|
"; %PT1H% * 1.5",
|
|
2263
2361
|
"# %PT1H30M%",
|
|
2264
2362
|
"; %PT1S% / 3",
|
|
2265
|
-
"# $!.time-inexact / FrameDuration
|
|
2363
|
+
"# $!.time-inexact / FrameDuration FrameCount",
|
|
2266
2364
|
"; (%PT1S% * 1000000000) / 1000000000",
|
|
2267
2365
|
"# %PT1S%",
|
|
2268
2366
|
"```",
|
|
@@ -2404,17 +2502,17 @@ export const HC_SOURCES = new Map([
|
|
|
2404
2502
|
"; 9.8.m.s-1 + 1.0.m.s-1",
|
|
2405
2503
|
"# $!.numeric-domain + FrameTypedNumber FrameTypedNumber",
|
|
2406
2504
|
"; 9.8.m + 1",
|
|
2407
|
-
"# $!.numeric-domain + FrameTypedNumber
|
|
2505
|
+
"# $!.numeric-domain + FrameTypedNumber FrameCount",
|
|
2408
2506
|
"; 1 + 9.8.m",
|
|
2409
|
-
"# $!.numeric-domain +
|
|
2507
|
+
"# $!.numeric-domain + FrameCount FrameTypedNumber",
|
|
2410
2508
|
"; 9.8.m 2",
|
|
2411
|
-
"# $!.numeric-domain * FrameTypedNumber
|
|
2509
|
+
"# $!.numeric-domain * FrameTypedNumber FrameCount",
|
|
2412
2510
|
"; 9.8.m / 2",
|
|
2413
|
-
"# $!.numeric-domain / FrameTypedNumber
|
|
2511
|
+
"# $!.numeric-domain / FrameTypedNumber FrameCount",
|
|
2414
2512
|
"; 9.8.m %% 2",
|
|
2415
|
-
"# $!.numeric-domain %% FrameTypedNumber
|
|
2513
|
+
"# $!.numeric-domain %% FrameTypedNumber FrameCount",
|
|
2416
2514
|
"; 9.8.m ** 2",
|
|
2417
|
-
"# $!.numeric-domain ** FrameTypedNumber
|
|
2515
|
+
"# $!.numeric-domain ** FrameTypedNumber FrameCount",
|
|
2418
2516
|
"; 9.8.m.< 10.2.m",
|
|
2419
2517
|
"# $!.numeric-domain < FrameTypedNumber FrameTypedNumber",
|
|
2420
2518
|
"; 9.8.m“Hi”",
|
|
@@ -2427,7 +2525,7 @@ export const HC_SOURCES = new Map([
|
|
|
2427
2525
|
"; 9.8.5",
|
|
2428
2526
|
"# 9.8.5",
|
|
2429
2527
|
"; 100.kg",
|
|
2430
|
-
"# $!.name-missing “$:
|
|
2528
|
+
"# $!.name-missing “$:FrameCount...",
|
|
2431
2529
|
"; (1 / 3).m",
|
|
2432
2530
|
"# $!.name-missing “$:FrameRational...",
|
|
2433
2531
|
"; (1 / 2.0).m",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Frame,
|
|
1
|
+
import { Frame, FrameCount, FrameString, FrameSymbol, } from "../frames.js";
|
|
2
2
|
import { EvalPipe, makeSourcePipe } from "./eval-pipe.js";
|
|
3
3
|
import { evaluateResourceSource } from "./resource-import.js";
|
|
4
4
|
import { sigilizer } from "./sigilizer.js";
|
|
@@ -12,7 +12,8 @@ import { sigilizer } from "./sigilizer.js";
|
|
|
12
12
|
* This method iterates over the entries and determines the type of each value
|
|
13
13
|
* based on its first character:
|
|
14
14
|
* - If alphabetic, the value is wrapped in a `FrameString`.
|
|
15
|
-
* - If numeric, the value is wrapped in a `
|
|
15
|
+
* - If numeric, the value is wrapped in a `FrameCount`, as the same digits
|
|
16
|
+
* written in source would be.
|
|
16
17
|
* - If neither, an error is logged and the key is set to `Frame.nil`.
|
|
17
18
|
*
|
|
18
19
|
* If the context contains a `DEBUG_ENV` key, the context is logged to the console
|
|
@@ -32,7 +33,7 @@ export function make_context(entries) {
|
|
|
32
33
|
const context = {};
|
|
33
34
|
Object.entries(entries).forEach(([key, value]) => {
|
|
34
35
|
if (/^\p{Nd}+$/u.test(value)) {
|
|
35
|
-
context[key] =
|
|
36
|
+
context[key] = FrameCount.for(value);
|
|
36
37
|
}
|
|
37
38
|
else {
|
|
38
39
|
context[key] = new FrameString(value);
|
|
@@ -27,7 +27,7 @@ export const syntaxFacets = [
|
|
|
27
27
|
frame.FrameDoc.SYNTAX,
|
|
28
28
|
frame.FrameName.SYNTAX,
|
|
29
29
|
frame.FrameScopeAnchor.SYNTAX,
|
|
30
|
-
frame.
|
|
30
|
+
frame.FrameCount.SYNTAX,
|
|
31
31
|
frame.FrameOperator.SYNTAX,
|
|
32
32
|
frame.FrameString.SYNTAX,
|
|
33
33
|
frame.FrameStringEnd.SYNTAX,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Frame } from "./frame.js";
|
|
2
1
|
/**
|
|
3
2
|
* NilContext is an empty context.
|
|
4
3
|
*/
|
|
@@ -31,7 +30,9 @@ export function contextEqual(left, right) {
|
|
|
31
30
|
*/
|
|
32
31
|
export function contextString(context) {
|
|
33
32
|
return Object.entries(context).map(([key, value]) => {
|
|
34
|
-
|
|
33
|
+
// `Frame.kOUT`, spelled out so this module imports Frame only as a type:
|
|
34
|
+
// a value import would evaluate frame.ts, which needs NilContext, first.
|
|
35
|
+
if (key === ">>") {
|
|
35
36
|
return `.${key} ${value.id};`;
|
|
36
37
|
}
|
|
37
38
|
else {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Load the FrameList cycle from FrameLazy, where it closes, so FrameList and
|
|
2
|
+
// FrameExpr exist before any subclass, whichever module is imported first.
|
|
3
|
+
import "./frame-lazy.js";
|
|
1
4
|
import { Frame } from "./frame.js";
|
|
2
5
|
import { BoundMethod } from "./bound-method.js";
|
|
3
6
|
import { methodEffect } from "./effect-marker.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FrameCount } from "./frame-count.js";
|
|
2
2
|
import { FrameAtom } from "./frame-atom.js";
|
|
3
3
|
import { NilContext } from "./context.js";
|
|
4
4
|
import { completeAtEnd, includeOrReserve } from "./atom-syntax.js";
|
|
@@ -174,7 +174,7 @@ Object.defineProperty(FrameBlob, "SYNTAX", {
|
|
|
174
174
|
fromSource: (source) => {
|
|
175
175
|
const lexeme = `${FrameBlob.BLOB_START}${source}`;
|
|
176
176
|
return /^\d+$/.test(lexeme)
|
|
177
|
-
?
|
|
177
|
+
? FrameCount.for(lexeme)
|
|
178
178
|
: new FrameBlob(lexeme);
|
|
179
179
|
},
|
|
180
180
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { completeAtEnd, includeOrReserve } from "./atom-syntax.js";
|
|
2
|
+
import { NilContext } from "./context.js";
|
|
3
|
+
import { FrameInt } from "./frame-int.js";
|
|
4
|
+
import { NUMERIC_RANK, } from "./frame-numeric.js";
|
|
5
|
+
/**
|
|
6
|
+
* Exact nonnegative integer, the root of the numeric ladder, and owner of
|
|
7
|
+
* decimal-digit source syntax: every digit literal is a count, `0` and
|
|
8
|
+
* `1234567890` alike.
|
|
9
|
+
*
|
|
10
|
+
* A count is a FrameInt that cannot be negative, so whatever accepts an integer
|
|
11
|
+
* accepts a count, and it prints exactly as the same integer does. It is closed
|
|
12
|
+
* under `+`, `*`, `%%`, and a nonnegative integral `**`, which therefore answer
|
|
13
|
+
* counts. The operations that can leave the domain answer the rung that holds
|
|
14
|
+
* their result whatever its sign: unary minus and `-` answer a FrameInt, and
|
|
15
|
+
* `/` answers a ratio, which collapses to a FrameInt when it is whole.
|
|
16
|
+
*/
|
|
17
|
+
export class FrameCount extends FrameInt {
|
|
18
|
+
static for(source) {
|
|
19
|
+
return new FrameCount(source);
|
|
20
|
+
}
|
|
21
|
+
constructor(source, meta = NilContext, spelling) {
|
|
22
|
+
super(source, meta, spelling);
|
|
23
|
+
Object.defineProperty(this, "rank", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: NUMERIC_RANK.count
|
|
28
|
+
});
|
|
29
|
+
if (this.data < 0n || this.spelling.startsWith("-")) {
|
|
30
|
+
throw new RangeError(`count must not be negative: ${this.spelling}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** A count is its own size, so `.#` and `.##` both answer it (#411). */
|
|
34
|
+
sizeFor(_key) {
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
promoteOne() {
|
|
38
|
+
return new FrameInt(this.data);
|
|
39
|
+
}
|
|
40
|
+
sameRung(value) {
|
|
41
|
+
return new FrameCount(value);
|
|
42
|
+
}
|
|
43
|
+
unaryPlus() {
|
|
44
|
+
return this.spelling.startsWith("+")
|
|
45
|
+
? this
|
|
46
|
+
: new FrameCount(this.data, NilContext, `+${this.spelling}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
Object.defineProperty(FrameCount, "SIGIL_STARTS", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: [
|
|
54
|
+
{ key: FrameCount.NUMBER_BEGIN.toString(), mode: "atom" },
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(FrameCount, "SYNTAX", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: {
|
|
62
|
+
NAME: "FrameCount",
|
|
63
|
+
SIGIL_STARTS: FrameCount.SIGIL_STARTS,
|
|
64
|
+
recognize: (symbol, source = "") => {
|
|
65
|
+
const char = symbol.toString();
|
|
66
|
+
return includeOrReserve(char, FrameCount.NUMBER_CHAR.test(char), source);
|
|
67
|
+
},
|
|
68
|
+
finish: completeAtEnd,
|
|
69
|
+
fromSource: (source) => FrameCount.for(source),
|
|
70
|
+
}
|
|
71
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NilContext } from "./context.js";
|
|
2
2
|
import { Frame } from "./frame.js";
|
|
3
|
-
import { exactBigIntPower, exactPowerWithinLimit, FrameNumeric, projectBigIntRatio, } from "./frame-numeric.js";
|
|
3
|
+
import { exactBigIntPower, exactPowerWithinLimit, FrameNumeric, NUMERIC_RANK, projectBigIntRatio, } from "./frame-numeric.js";
|
|
4
4
|
import { FrameNumber } from "./frame-number.js";
|
|
5
5
|
import { FrameRational } from "./frame-rational.js";
|
|
6
6
|
import { FrameSequence } from "./frame-sequence.js";
|
|
@@ -32,7 +32,7 @@ export class FrameDecimal extends FrameNumeric {
|
|
|
32
32
|
enumerable: true,
|
|
33
33
|
configurable: true,
|
|
34
34
|
writable: true,
|
|
35
|
-
value:
|
|
35
|
+
value: NUMERIC_RANK.decimal
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(this, "numerator", {
|
|
38
38
|
enumerable: true,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Load the FrameList cycle from FrameLazy, where it closes, so FrameList and
|
|
2
|
+
// FrameExpr exist before any subclass, whichever module is imported first.
|
|
3
|
+
import "./frame-lazy.js";
|
|
1
4
|
import { Frame } from "./frame.js";
|
|
2
5
|
import { FrameList } from "./frame-list.js";
|
|
3
6
|
import { NilContext } from "./context.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { completeAtEnd, includeOrReserve } from "./atom-syntax.js";
|
|
2
1
|
import { NilContext } from "./context.js";
|
|
3
2
|
import { FrameDecimal } from "./frame-decimal.js";
|
|
4
3
|
import { Frame } from "./frame.js";
|
|
5
|
-
import { exactBigIntPower, exactPowerWithinLimit, FrameNumeric, REPETITION_LIMIT, REPETITION_TEXT_LIMIT, } from "./frame-numeric.js";
|
|
4
|
+
import { exactBigIntPower, exactPowerWithinLimit, FrameNumeric, NUMERIC_RANK, REPETITION_LIMIT, REPETITION_TEXT_LIMIT, } from "./frame-numeric.js";
|
|
6
5
|
import { hasCharacterContent } from "./frame-text.js";
|
|
7
6
|
import { FrameNumber } from "./frame-number.js";
|
|
8
7
|
const INTEGER_SOURCE = /^[+-]?[\p{Nd}]+$/u;
|
|
@@ -22,7 +21,13 @@ function normalizeDecimalDigits(source) {
|
|
|
22
21
|
return ((codePoint - blockStart) % 10).toString();
|
|
23
22
|
}).join("");
|
|
24
23
|
}
|
|
25
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Exact bigint-backed signed integer.
|
|
26
|
+
*
|
|
27
|
+
* No literal produces one: the digits a source spells are a `FrameCount`, which
|
|
28
|
+
* owns that syntax. A FrameInt is what an operation answers once its result may
|
|
29
|
+
* be negative, such as unary minus or subtraction.
|
|
30
|
+
*/
|
|
26
31
|
export class FrameInt extends FrameNumeric {
|
|
27
32
|
static for(source) {
|
|
28
33
|
return new FrameInt(source);
|
|
@@ -33,7 +38,7 @@ export class FrameInt extends FrameNumeric {
|
|
|
33
38
|
enumerable: true,
|
|
34
39
|
configurable: true,
|
|
35
40
|
writable: true,
|
|
36
|
-
value:
|
|
41
|
+
value: NUMERIC_RANK.int
|
|
37
42
|
});
|
|
38
43
|
Object.defineProperty(this, "data", {
|
|
39
44
|
enumerable: true,
|
|
@@ -119,22 +124,31 @@ export class FrameInt extends FrameNumeric {
|
|
|
119
124
|
const spelling = this.spelling.startsWith("-") ? unsigned : `-${unsigned}`;
|
|
120
125
|
return new FrameInt(-this.data, NilContext, spelling);
|
|
121
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* The integer `value` on this frame's own rung, for the operations every
|
|
129
|
+
* integer rung is closed under: `+`, `*`, `%%`, and a nonnegative integral
|
|
130
|
+
* `**`. A count is not closed under `-`, which is why subtraction builds a
|
|
131
|
+
* FrameInt rather than asking here.
|
|
132
|
+
*/
|
|
133
|
+
sameRung(value) {
|
|
134
|
+
return new FrameInt(value);
|
|
135
|
+
}
|
|
122
136
|
addSame(right) {
|
|
123
|
-
return
|
|
137
|
+
return this.sameRung(this.data + right.data);
|
|
124
138
|
}
|
|
125
139
|
subtractSame(right) {
|
|
126
140
|
return new FrameInt(this.data - right.data);
|
|
127
141
|
}
|
|
128
142
|
multiplySame(right) {
|
|
129
|
-
return
|
|
143
|
+
return this.sameRung(this.data * right.data);
|
|
130
144
|
}
|
|
131
145
|
divideSame(_right) {
|
|
132
|
-
return Frame.error(
|
|
146
|
+
return Frame.error(`$!.numeric-internal / ${this.className()}`);
|
|
133
147
|
}
|
|
134
148
|
moduloSame(right) {
|
|
135
149
|
const divisor = right.data;
|
|
136
150
|
const remainder = this.data % divisor;
|
|
137
|
-
return
|
|
151
|
+
return this.sameRung(remainder !== 0n && (remainder < 0n) !== (divisor < 0n)
|
|
138
152
|
? remainder + divisor
|
|
139
153
|
: remainder);
|
|
140
154
|
}
|
|
@@ -144,12 +158,12 @@ export class FrameInt extends FrameNumeric {
|
|
|
144
158
|
}
|
|
145
159
|
powerIntegral(exponent) {
|
|
146
160
|
if (exponent < 0n) {
|
|
147
|
-
return Frame.error(
|
|
161
|
+
return Frame.error(`$!.numeric-internal ** ${this.className()}`);
|
|
148
162
|
}
|
|
149
163
|
if (!exactPowerWithinLimit([this.data], exponent)) {
|
|
150
|
-
return Frame.error(
|
|
164
|
+
return Frame.error(`$!.numeric-range ** ${this.className()}`);
|
|
151
165
|
}
|
|
152
|
-
return
|
|
166
|
+
return this.sameRung(exactBigIntPower(this.data, exponent));
|
|
153
167
|
}
|
|
154
168
|
compareSame(right) {
|
|
155
169
|
const value = right.data;
|
|
@@ -183,26 +197,3 @@ Object.defineProperty(FrameInt, "NUMBER_CHAR", {
|
|
|
183
197
|
writable: true,
|
|
184
198
|
value: /\d/
|
|
185
199
|
});
|
|
186
|
-
Object.defineProperty(FrameInt, "SIGIL_STARTS", {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
configurable: true,
|
|
189
|
-
writable: true,
|
|
190
|
-
value: [
|
|
191
|
-
{ key: FrameInt.NUMBER_BEGIN.toString(), mode: "atom" },
|
|
192
|
-
]
|
|
193
|
-
});
|
|
194
|
-
Object.defineProperty(FrameInt, "SYNTAX", {
|
|
195
|
-
enumerable: true,
|
|
196
|
-
configurable: true,
|
|
197
|
-
writable: true,
|
|
198
|
-
value: {
|
|
199
|
-
NAME: "FrameInt",
|
|
200
|
-
SIGIL_STARTS: FrameInt.SIGIL_STARTS,
|
|
201
|
-
recognize: (symbol, source = "") => {
|
|
202
|
-
const char = symbol.toString();
|
|
203
|
-
return includeOrReserve(char, FrameInt.NUMBER_CHAR.test(char), source);
|
|
204
|
-
},
|
|
205
|
-
finish: completeAtEnd,
|
|
206
|
-
fromSource: (source) => FrameInt.for(source),
|
|
207
|
-
}
|
|
208
|
-
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Frame } from "./frame.js";
|
|
2
2
|
import { NilContext } from "./context.js";
|
|
3
3
|
import { EvaluationScope } from "./evaluation-scope.js";
|
|
4
|
+
import { FrameCount } from "./frame-count.js";
|
|
4
5
|
import { renderNested } from "./stringify.js";
|
|
5
6
|
/**
|
|
6
7
|
* The declaration a term recorded, when it is a declaration echo.
|
|
@@ -105,6 +106,42 @@ export class FrameList extends Frame {
|
|
|
105
106
|
elements() {
|
|
106
107
|
return this.data.filter((item) => item.is.statement !== true && !this.holdsAsProperty(item));
|
|
107
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* `.#` counts this aggregate's elements and `.##` the leaves below them
|
|
111
|
+
* (#411), so neither counts a property. Every aggregate is a list, so each
|
|
112
|
+
* one answers here rather than in its own class.
|
|
113
|
+
*/
|
|
114
|
+
sizeFor(key) {
|
|
115
|
+
if (key === Frame.kCOUNT) {
|
|
116
|
+
return new FrameCount(BigInt(this.elements().length));
|
|
117
|
+
}
|
|
118
|
+
const leaves = this.leafCount(new Set());
|
|
119
|
+
return leaves === undefined
|
|
120
|
+
? Frame.error(`$!.cyclic-aggregate .${key}`)
|
|
121
|
+
: new FrameCount(leaves);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The leaves below this aggregate: each element that is not itself an
|
|
125
|
+
* aggregate counts once, at any depth, so an empty aggregate adds none.
|
|
126
|
+
* `path` holds only the aggregates from the root down to this one, so a
|
|
127
|
+
* branch reached twice counts twice, and one that contains itself answers
|
|
128
|
+
* undefined.
|
|
129
|
+
*/
|
|
130
|
+
leafCount(path) {
|
|
131
|
+
if (path.has(this))
|
|
132
|
+
return undefined;
|
|
133
|
+
path.add(this);
|
|
134
|
+
let leaves = 0n;
|
|
135
|
+
for (const element of this.elements()) {
|
|
136
|
+
const value = element.referent();
|
|
137
|
+
const below = value instanceof FrameList ? value.leafCount(path) : 1n;
|
|
138
|
+
if (below === undefined)
|
|
139
|
+
return undefined;
|
|
140
|
+
leaves += below;
|
|
141
|
+
}
|
|
142
|
+
path.delete(this);
|
|
143
|
+
return leaves;
|
|
144
|
+
}
|
|
108
145
|
/**
|
|
109
146
|
* The value a term answered, looking through a statement's wrapper.
|
|
110
147
|
*
|
|
@@ -23,6 +23,15 @@ const recognizeName = (symbol, source = "") => {
|
|
|
23
23
|
if (source.endsWith("^")) {
|
|
24
24
|
return { disposition: ScanDisposition.CompleteRedispatch };
|
|
25
25
|
}
|
|
26
|
+
// `#` begins a comment except where it spells a size operator, `.#` or `.##`
|
|
27
|
+
// (#411), which nothing extends: `.foo#bar` still ends at its `#`, and `.###`
|
|
28
|
+
// is `.##` before a comment.
|
|
29
|
+
if ([Frame.kCOUNT, Frame.kLEAVES].includes(source + char)) {
|
|
30
|
+
return { disposition: ScanDisposition.Consume };
|
|
31
|
+
}
|
|
32
|
+
if (source.startsWith(Frame.kCOUNT)) {
|
|
33
|
+
return { disposition: ScanDisposition.CompleteRedispatch };
|
|
34
|
+
}
|
|
26
35
|
// `.^` needs no rule of its own: `^` is an operator character, so it is
|
|
27
36
|
// consumed and completed like any other name.
|
|
28
37
|
if (!includes(char)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NilContext } from "./context.js";
|
|
2
|
-
import { FrameNumeric } from "./frame-numeric.js";
|
|
2
|
+
import { FrameNumeric, NUMERIC_RANK, } from "./frame-numeric.js";
|
|
3
3
|
/** Inexact host-number rung, reached only by projection or inexact arithmetic. */
|
|
4
4
|
export class FrameNumber extends FrameNumeric {
|
|
5
5
|
static for(value) {
|
|
@@ -16,7 +16,7 @@ export class FrameNumber extends FrameNumeric {
|
|
|
16
16
|
enumerable: true,
|
|
17
17
|
configurable: true,
|
|
18
18
|
writable: true,
|
|
19
|
-
value:
|
|
19
|
+
value: NUMERIC_RANK.number
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(this, "data", {
|
|
22
22
|
enumerable: true,
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { FrameAtom } from "./frame-atom.js";
|
|
2
2
|
import { Frame } from "./frame.js";
|
|
3
|
+
/**
|
|
4
|
+
* The promotion ladder, root first: a rung's rank is its position here. The
|
|
5
|
+
* dispatch below names rungs only through this table, so a rung inserted below
|
|
6
|
+
* the root, such as a future `FrameBit`, renumbers this table and nothing else.
|
|
7
|
+
*/
|
|
8
|
+
export const NUMERIC_RANK = {
|
|
9
|
+
count: 0,
|
|
10
|
+
int: 1,
|
|
11
|
+
decimal: 2,
|
|
12
|
+
rational: 3,
|
|
13
|
+
number: 4,
|
|
14
|
+
};
|
|
3
15
|
/** The largest count accepted by integer repetition. */
|
|
4
16
|
export const REPETITION_LIMIT = 65536n;
|
|
5
17
|
/** The largest UTF-16 text result accepted by integer repetition. */
|
|
@@ -82,13 +94,15 @@ export class FrameNumeric extends FrameAtom {
|
|
|
82
94
|
}
|
|
83
95
|
if (right.isZero())
|
|
84
96
|
return Frame.error("$!.division-by-zero /");
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
const { decimal, number, rational } = NUMERIC_RANK;
|
|
98
|
+
// Never below the rational rung: an exact quotient is a ratio, and one
|
|
99
|
+
// whose denominator reduces to 1 collapses to FrameInt, never to a count.
|
|
100
|
+
const target = this.rank === number || right.rank === decimal || right.rank === number
|
|
101
|
+
? number
|
|
102
|
+
: rational;
|
|
103
|
+
if (target === number && this.rank !== number && right.rank !== number) {
|
|
104
|
+
const projectedLeft = this.promoteTo(number);
|
|
105
|
+
const projectedRight = right.promoteTo(number);
|
|
92
106
|
const leftValue = Number(projectedLeft.valueOf());
|
|
93
107
|
const rightValue = Number(projectedRight.valueOf());
|
|
94
108
|
if (Number.isFinite(leftValue) && Number.isFinite(rightValue) &&
|
|
@@ -105,13 +119,16 @@ export class FrameNumeric extends FrameAtom {
|
|
|
105
119
|
}
|
|
106
120
|
return this.promoteTo(target).divideSame(right.promoteTo(target));
|
|
107
121
|
}
|
|
122
|
+
/** Integer rungs only, joined like `+`, so two counts answer a count. */
|
|
108
123
|
modulo(right) {
|
|
109
|
-
if (this.rank
|
|
124
|
+
if (this.rank == null || right.rank == null ||
|
|
125
|
+
this.rank > NUMERIC_RANK.int || right.rank > NUMERIC_RANK.int) {
|
|
110
126
|
return this.operationError("%%", right);
|
|
111
127
|
}
|
|
112
128
|
if (right.isZero())
|
|
113
129
|
return Frame.error("$!.modulo-by-zero %%");
|
|
114
|
-
|
|
130
|
+
const target = Math.max(this.rank, right.rank);
|
|
131
|
+
return this.promoteTo(target).moduloSame(right.promoteTo(target));
|
|
115
132
|
}
|
|
116
133
|
power(right) {
|
|
117
134
|
if (this.rank == null || right.rank == null) {
|
|
@@ -119,15 +136,15 @@ export class FrameNumeric extends FrameAtom {
|
|
|
119
136
|
}
|
|
120
137
|
const exponent = right.integralValue();
|
|
121
138
|
if (exponent == null) {
|
|
122
|
-
const leftNumber = this.promoteTo(
|
|
123
|
-
const rightNumber = right.promoteTo(
|
|
139
|
+
const leftNumber = this.promoteTo(NUMERIC_RANK.number);
|
|
140
|
+
const rightNumber = right.promoteTo(NUMERIC_RANK.number);
|
|
124
141
|
return leftNumber.powerSame(rightNumber);
|
|
125
142
|
}
|
|
126
143
|
if (exponent < 0n && this.isZero()) {
|
|
127
144
|
return Frame.error("$!.division-by-zero **");
|
|
128
145
|
}
|
|
129
|
-
if (exponent < 0n && this.rank !==
|
|
130
|
-
return this.promoteTo(
|
|
146
|
+
if (exponent < 0n && this.rank !== NUMERIC_RANK.number) {
|
|
147
|
+
return this.promoteTo(NUMERIC_RANK.rational).powerIntegral(exponent);
|
|
131
148
|
}
|
|
132
149
|
return this.powerIntegral(exponent);
|
|
133
150
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NilContext } from "./context.js";
|
|
2
2
|
import { FrameInt } from "./frame-int.js";
|
|
3
3
|
import { Frame } from "./frame.js";
|
|
4
|
-
import { exactBigIntPower, exactPowerWithinLimit, FrameNumeric, projectBigIntRatio, } from "./frame-numeric.js";
|
|
4
|
+
import { exactBigIntPower, exactPowerWithinLimit, FrameNumeric, NUMERIC_RANK, projectBigIntRatio, } from "./frame-numeric.js";
|
|
5
5
|
import { FrameNumber } from "./frame-number.js";
|
|
6
6
|
function greatestCommonDivisor(left, right) {
|
|
7
7
|
let a = left < 0n ? -left : left;
|
|
@@ -13,6 +13,7 @@ function greatestCommonDivisor(left, right) {
|
|
|
13
13
|
}
|
|
14
14
|
/** Reduced exact ratio with a positive denominator. */
|
|
15
15
|
export class FrameRational extends FrameNumeric {
|
|
16
|
+
/** A whole result collapses to FrameInt, never to a count, whatever its sign. */
|
|
16
17
|
static create(numerator, denominator) {
|
|
17
18
|
if (denominator === 0n)
|
|
18
19
|
return Frame.error("$!.division-by-zero /");
|
|
@@ -27,7 +28,7 @@ export class FrameRational extends FrameNumeric {
|
|
|
27
28
|
enumerable: true,
|
|
28
29
|
configurable: true,
|
|
29
30
|
writable: true,
|
|
30
|
-
value:
|
|
31
|
+
value: NUMERIC_RANK.rational
|
|
31
32
|
});
|
|
32
33
|
Object.defineProperty(this, "numerator", {
|
|
33
34
|
enumerable: true,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
import { Frame } from "./frame.js";
|
|
25
|
-
import {
|
|
25
|
+
import { FrameCount } from "./frame-count.js";
|
|
26
26
|
import { FrameString } from "./frame-string.js";
|
|
27
27
|
import { FrameURI } from "./frame-uri.js";
|
|
28
28
|
import { hasCharacterContent } from "./frame-text.js";
|
|
@@ -107,12 +107,12 @@ export class FrameResource extends FrameURI {
|
|
|
107
107
|
if (placement.kind === "scheme") {
|
|
108
108
|
const written = placement.handler.write(placement.parts, content);
|
|
109
109
|
return written.ok
|
|
110
|
-
?
|
|
110
|
+
? FrameCount.for(written.count.toString())
|
|
111
111
|
: this.storeRefusal(written.reason);
|
|
112
112
|
}
|
|
113
113
|
const written = this.store.write(placement.path, content);
|
|
114
114
|
return written.ok
|
|
115
|
-
?
|
|
115
|
+
? FrameCount.for(written.content.length.toString())
|
|
116
116
|
: this.storeRefusal(written.reason);
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Load the FrameList cycle from FrameLazy, where it closes, so FrameList and
|
|
2
|
+
// FrameExpr exist before any subclass, whichever module is imported first.
|
|
3
|
+
import "./frame-lazy.js";
|
|
1
4
|
import { Frame } from "./frame.js";
|
|
2
5
|
import { FrameList } from "./frame-list.js";
|
|
3
6
|
import { FrameNote } from "./frame-note.js";
|
|
@@ -260,6 +260,13 @@ export class FrameSymbol extends FrameAtom {
|
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
called_by(context) {
|
|
263
|
+
// A size operator answers for the receiver itself rather than looking a
|
|
264
|
+
// name up, so the scope a value was read from never answers for it (#411).
|
|
265
|
+
// Only an address is one, since the lexer looks `#` up as the comment.
|
|
266
|
+
if (this.is.address === true &&
|
|
267
|
+
(this.data === Frame.kCOUNT || this.data === Frame.kLEAVES)) {
|
|
268
|
+
return context.referent().sizeFor(this.data);
|
|
269
|
+
}
|
|
263
270
|
return this.in([context]);
|
|
264
271
|
}
|
|
265
272
|
string_start() {
|
package/esm/lib/frames/frame.js
CHANGED
|
@@ -210,6 +210,13 @@ export class Frame extends MetaFrame {
|
|
|
210
210
|
referent() {
|
|
211
211
|
return this;
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* What this frame answers for a size operator, `.#` or `.##` (#411). Only an
|
|
215
|
+
* aggregate counts and a count is its own size, so anything else is nil.
|
|
216
|
+
*/
|
|
217
|
+
sizeFor(_key) {
|
|
218
|
+
return Frame.nil;
|
|
219
|
+
}
|
|
213
220
|
/**
|
|
214
221
|
* Get a frame by key from this frame's own properties and its declared
|
|
215
222
|
* parents only, never its lexical scope.
|
|
@@ -504,6 +511,24 @@ Object.defineProperty(Frame, "kEND", {
|
|
|
504
511
|
writable: true,
|
|
505
512
|
value: "$$"
|
|
506
513
|
});
|
|
514
|
+
/**
|
|
515
|
+
* kCOUNT is the size operator `.#`, an aggregate's element count (#411).
|
|
516
|
+
*/
|
|
517
|
+
Object.defineProperty(Frame, "kCOUNT", {
|
|
518
|
+
enumerable: true,
|
|
519
|
+
configurable: true,
|
|
520
|
+
writable: true,
|
|
521
|
+
value: "#"
|
|
522
|
+
});
|
|
523
|
+
/**
|
|
524
|
+
* kLEAVES is the size operator `.##`, an aggregate's leaf count (#411).
|
|
525
|
+
*/
|
|
526
|
+
Object.defineProperty(Frame, "kLEAVES", {
|
|
527
|
+
enumerable: true,
|
|
528
|
+
configurable: true,
|
|
529
|
+
writable: true,
|
|
530
|
+
value: "##"
|
|
531
|
+
});
|
|
507
532
|
/**
|
|
508
533
|
* BEGIN_EXPR is the symbol for the beginning of an expression.
|
|
509
534
|
*/
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Load the FrameList cycle from FrameLazy, where it closes, so FrameList and
|
|
2
|
+
// FrameExpr exist before any subclass, whichever module is imported first.
|
|
3
|
+
import "./frame-lazy.js";
|
|
1
4
|
import { Frame } from "./frame.js";
|
|
2
5
|
import { FrameList } from "./frame-list.js";
|
|
3
6
|
import { isFrameMatcher, matchFailure, matchSuccess, } from "./frame-match.js";
|
package/esm/lib/frames.js
CHANGED
|
@@ -22,8 +22,9 @@ export { FrameList } from "./frames/frame-list.js";
|
|
|
22
22
|
export { FrameName } from "./frames/frame-name.js";
|
|
23
23
|
export { FrameNote } from "./frames/frame-note.js";
|
|
24
24
|
export { FrameScopeAnchor, } from "./frames/frame-scope-anchor.js";
|
|
25
|
-
export { FrameNumeric } from "./frames/frame-numeric.js";
|
|
25
|
+
export { FrameNumeric, NUMERIC_RANK, } from "./frames/frame-numeric.js";
|
|
26
26
|
export { FrameInt } from "./frames/frame-int.js";
|
|
27
|
+
export { FrameCount } from "./frames/frame-count.js";
|
|
27
28
|
export { FrameDecimal } from "./frames/frame-decimal.js";
|
|
28
29
|
export { FrameSequence } from "./frames/frame-sequence.js";
|
|
29
30
|
export { FrameTypedNumber } from "./frames/frame-typed-number.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Direct, not ../frames.ts, whose ../ops.ts needs this module loaded first.
|
|
2
|
+
import { Frame } from "../frames/frame.js";
|
|
2
3
|
export const IfThen = (source, block, receiverState) => {
|
|
3
4
|
if (source !== Frame.nil) {
|
|
4
5
|
return block.call(Frame.nil, Frame.nil, receiverState);
|
package/esm/lib/ops/iterators.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// Direct, not ../frames.ts, whose ../ops.ts needs this module loaded first.
|
|
2
|
+
import { Frame } from "../frames/frame.js";
|
|
3
|
+
import { FrameArray } from "../frames/frame-array.js";
|
|
4
|
+
import { FrameSymbol } from "../frames/frame-symbol.js";
|
|
2
5
|
/**
|
|
3
6
|
* Iteration is application, twice.
|
|
4
7
|
*
|
package/esm/lib/ops/math.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// Direct, not ../frames.ts, whose ../ops.ts needs this module loaded first.
|
|
2
|
+
import { Frame } from "../frames/frame.js";
|
|
3
|
+
import { FrameNumeric } from "../frames/frame-numeric.js";
|
|
2
4
|
const numeric = (source, block, operation) => {
|
|
3
5
|
return source instanceof FrameNumeric && block instanceof FrameNumeric
|
|
4
6
|
? operation(source, block)
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// Direct, not ../frames.ts, whose ../ops.ts needs this module loaded first.
|
|
2
|
+
import { Frame } from "../frames/frame.js";
|
|
3
|
+
import { FrameLazy } from "../frames/frame-lazy.js";
|
|
4
|
+
import { FrameLiteral } from "../frames/frame-symbol.js";
|
|
5
|
+
import { isFrameMatcher } from "../frames/frame-match.js";
|
|
2
6
|
/** Test whether a value belongs to a first-class type or schema. */
|
|
3
7
|
export const HasType = (source, type) => {
|
|
4
8
|
if (type === Frame.all)
|
package/esm/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.21.1";
|