hclang 0.20.1 → 0.20.3
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/README.md +1 -1
- package/esm/cli/hc.js +6 -6
- package/esm/lib/bundle/hc-bundle.js +35 -0
- package/esm/lib/bundle/hc-sources.js +3795 -0
- package/esm/lib/execute/lex-pipe.js +7 -0
- package/esm/lib/execute/resource-import.js +90 -5
- package/esm/lib/frames/bound-method.js +5 -5
- package/esm/lib/frames/evaluation-scope.js +24 -7
- package/esm/lib/frames/frame-alias.js +20 -19
- package/esm/lib/frames/frame-array.js +73 -35
- package/esm/lib/frames/frame-handle.js +51 -24
- package/esm/lib/frames/frame-string.js +12 -6
- package/esm/lib/frames/frame-symbol.js +8 -5
- package/esm/lib/frames/frame.js +49 -5
- package/esm/lib/frames/resource-store.js +34 -9
- package/esm/lib/version.js +1 -1
- package/package.json +1 -1
- package/esm/lib/modules/standard-modules.js +0 -42
- package/esm/lib/modules/standard-sources.js +0 -316
package/esm/lib/frames/frame.js
CHANGED
|
@@ -210,6 +210,28 @@ export class Frame extends MetaFrame {
|
|
|
210
210
|
referent() {
|
|
211
211
|
return this;
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Get a frame by key from this frame's own properties and its declared
|
|
215
|
+
* parents only, never its lexical scope.
|
|
216
|
+
*
|
|
217
|
+
* This is how a call reads its explicit argument (spec 7, layer 2). The
|
|
218
|
+
* argument's lexical scope is wherever that value was built, which the
|
|
219
|
+
* closure did not choose, so following it would let any scope that built an
|
|
220
|
+
* argument bind the closure's names. A handle reads its target, and still
|
|
221
|
+
* binds a method it finds to that target.
|
|
222
|
+
*/
|
|
223
|
+
getOwn(key, origin = this) {
|
|
224
|
+
const seen = new Set();
|
|
225
|
+
let frame = this.referent();
|
|
226
|
+
while (frame && !seen.has(frame)) {
|
|
227
|
+
seen.add(frame);
|
|
228
|
+
const local = frame.lookup_here(key, origin);
|
|
229
|
+
if (!local.is.missing)
|
|
230
|
+
return this.lookup_result(local, key);
|
|
231
|
+
frame = frame.hasDeclaredParent() ? frame.parent : undefined;
|
|
232
|
+
}
|
|
233
|
+
return Frame.missing;
|
|
234
|
+
}
|
|
213
235
|
/** Whether a write can land on this frame, so that identity is observable. */
|
|
214
236
|
ownsIdentity() {
|
|
215
237
|
return false;
|
|
@@ -335,6 +357,16 @@ export class Frame extends MetaFrame {
|
|
|
335
357
|
applicationMethod() {
|
|
336
358
|
return undefined;
|
|
337
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* What this frame contributes when text receives it (#398).
|
|
362
|
+
*
|
|
363
|
+
* A frame contributes itself, so text takes its characters or its spelling.
|
|
364
|
+
* An aggregate may declare `toText` to answer something more readable; see
|
|
365
|
+
* `FrameArray.toText`.
|
|
366
|
+
*/
|
|
367
|
+
toText() {
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
338
370
|
/**
|
|
339
371
|
* The values this frame streams when it is iterated.
|
|
340
372
|
*
|
|
@@ -421,14 +453,26 @@ export class Frame extends MetaFrame {
|
|
|
421
453
|
* shields an immutable receiver from a mutating method. Atoms are immutable
|
|
422
454
|
* and closures are shared bodies, so for them sharing is unobservable and the
|
|
423
455
|
* default is to share. Aggregates own identity, so `FrameArray` overrides this
|
|
424
|
-
* to hand back a fresh
|
|
425
|
-
*
|
|
426
|
-
* The map memoizes aggregates already copied in this operation, so a nested
|
|
427
|
-
* aggregate reached twice stays one aggregate and a cyclic chain terminates.
|
|
456
|
+
* to hand back a fresh aggregate whose members are still shared (#401).
|
|
428
457
|
*/
|
|
429
|
-
instanceCopy(
|
|
458
|
+
instanceCopy() {
|
|
430
459
|
return this;
|
|
431
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* Replaces a member that is exactly `member` with `replacement`, answering
|
|
463
|
+
* whether one was found. Copy-on-write uses it to install a copy of a member
|
|
464
|
+
* into the copy that holds it, so only declared slots are searched here.
|
|
465
|
+
*/
|
|
466
|
+
replaceMember(member, replacement) {
|
|
467
|
+
let replaced = false;
|
|
468
|
+
for (const [key, value] of this.meta_pairs()) {
|
|
469
|
+
if (value === member) {
|
|
470
|
+
this.meta[key] = replacement;
|
|
471
|
+
replaced = true;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return replaced;
|
|
475
|
+
}
|
|
432
476
|
/**
|
|
433
477
|
* Negation is decided by the symbol's name, never by how it prints.
|
|
434
478
|
*
|
|
@@ -63,6 +63,27 @@ export class MemoryStore {
|
|
|
63
63
|
return { ok: true, content };
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* The copies `canonicalEntries` made. None escapes this module except through
|
|
68
|
+
* `ResourceMapStore.overlay`, which hands it only back to the constructor, so a
|
|
69
|
+
* member is already checked and no caller can change it.
|
|
70
|
+
*/
|
|
71
|
+
const CANONICAL = new WeakSet();
|
|
72
|
+
/** Checks every key is a canonical nonempty path, and copies the entries. */
|
|
73
|
+
function canonicalEntries(entries) {
|
|
74
|
+
if (CANONICAL.has(entries))
|
|
75
|
+
return entries;
|
|
76
|
+
const copied = new Map();
|
|
77
|
+
for (const [key, content] of entries) {
|
|
78
|
+
const normal = normalizeReferencePath(key);
|
|
79
|
+
if (key === "" || !normal.ok || normal.path !== key) {
|
|
80
|
+
throw new TypeError(`ResourceMapStore key must be a canonical nonempty path: ${JSON.stringify(key)}`);
|
|
81
|
+
}
|
|
82
|
+
copied.set(key, content);
|
|
83
|
+
}
|
|
84
|
+
CANONICAL.add(copied);
|
|
85
|
+
return copied;
|
|
86
|
+
}
|
|
66
87
|
/**
|
|
67
88
|
* A read-only overlay of fixed entries, keyed by canonical root-relative path,
|
|
68
89
|
* on another store.
|
|
@@ -73,6 +94,8 @@ export class MemoryStore {
|
|
|
73
94
|
* path the root plane itself would produce can be installed; a key that fails is
|
|
74
95
|
* a harness defect, and the constructor throws rather than refusing. The entries
|
|
75
96
|
* are copied, so the caller's map cannot change what the overlay serves.
|
|
97
|
+
* `overlay` checks and copies once for a harness that lays the same entries over
|
|
98
|
+
* many stores.
|
|
76
99
|
*/
|
|
77
100
|
export class ResourceMapStore {
|
|
78
101
|
constructor(underlying, entries) {
|
|
@@ -83,15 +106,17 @@ export class ResourceMapStore {
|
|
|
83
106
|
value: underlying
|
|
84
107
|
});
|
|
85
108
|
_ResourceMapStore_entries.set(this, void 0);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
__classPrivateFieldSet(this, _ResourceMapStore_entries, canonicalEntries(entries), "f");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Checks and copies fixed entries once, for laying over any number of stores.
|
|
113
|
+
*
|
|
114
|
+
* @param entries The fixed entries, by canonical root-relative path.
|
|
115
|
+
* @returns A function that lays those entries over a store.
|
|
116
|
+
*/
|
|
117
|
+
static overlay(entries) {
|
|
118
|
+
const fixed = canonicalEntries(entries);
|
|
119
|
+
return (underlying) => new ResourceMapStore(underlying, fixed);
|
|
95
120
|
}
|
|
96
121
|
describe() {
|
|
97
122
|
return this.underlying.describe();
|
package/esm/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.20.
|
|
1
|
+
export const VERSION = "0.20.3";
|
package/package.json
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The standard modules every supported host serves, read-only, under canonical
|
|
3
|
-
* keys.
|
|
4
|
-
*
|
|
5
|
-
* A standard module is HC source the package maintains: every
|
|
6
|
-
* `lib/modules/*.hc` is one, under the key `modules/<file>`, so
|
|
7
|
-
* `lib/modules/figures.hc` is reached from a program as
|
|
8
|
-
* `'./modules/figures.hc'`. The key is root-relative like every other path, so
|
|
9
|
-
* it names a location inside the root binding, never one beside a source file
|
|
10
|
-
* or the working directory. A host lays the modules over its root's store as
|
|
11
|
-
* fixed entries: reading one answers the maintained source, writing one is
|
|
12
|
-
* refused, and every other path, a sibling under `modules/` included, still
|
|
13
|
-
* resolves inside that root. No permission flag and no root widens, so a program
|
|
14
|
-
* gains these reads and nothing else.
|
|
15
|
-
*
|
|
16
|
-
* The sources are compiled into the program from the generated
|
|
17
|
-
* `lib/modules/standard-sources.ts` (`deno task modules:embed`), so the CLI, the
|
|
18
|
-
* compiled binary, the npm package, `HCLang`, and the browser playground serve
|
|
19
|
-
* the same text without reading a file at run time.
|
|
20
|
-
*
|
|
21
|
-
* @module
|
|
22
|
-
*/
|
|
23
|
-
import { ResourceMapStore, } from "../frames/resource-store.js";
|
|
24
|
-
import { STANDARD_SOURCES } from "./standard-sources.js";
|
|
25
|
-
const MODULES = STANDARD_SOURCES;
|
|
26
|
-
/**
|
|
27
|
-
* The standard modules by canonical key.
|
|
28
|
-
*
|
|
29
|
-
* @returns Each module's source under its key.
|
|
30
|
-
*/
|
|
31
|
-
export function standardModules() {
|
|
32
|
-
return MODULES;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Lays the standard modules over a store as read-only entries.
|
|
36
|
-
*
|
|
37
|
-
* @param store The root's store, which keeps every other path.
|
|
38
|
-
* @returns A store that serves the standard modules and delegates the rest.
|
|
39
|
-
*/
|
|
40
|
-
export function withStandardModules(store) {
|
|
41
|
-
return new ResourceMapStore(store, MODULES);
|
|
42
|
-
}
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
// Generated by scripts/embed-modules.ts from lib/modules/*.hc. Do not edit.
|
|
2
|
-
// Regenerate with `deno task modules:embed`.
|
|
3
|
-
/**
|
|
4
|
-
* The maintained source of every `lib/modules/*.hc`, by canonical key, each
|
|
5
|
-
* joined from its lines.
|
|
6
|
-
*/
|
|
7
|
-
export const STANDARD_SOURCES = new Map([
|
|
8
|
-
[
|
|
9
|
-
"modules/figures.hc",
|
|
10
|
-
[
|
|
11
|
-
"#!/usr/bin/env hc",
|
|
12
|
-
"```",
|
|
13
|
-
"Figures (#382)",
|
|
14
|
-
"",
|
|
15
|
-
'Ported from History 005.30c, "The Figure class as idiomatic HC", in',
|
|
16
|
-
"`quilt+s3://protology#package=occurrence/history`. Relational Construction Theory",
|
|
17
|
-
"has one generative operation: construct a Figure with optional, already",
|
|
18
|
-
"constructed children. In HC that operation is the array literal, so nothing is",
|
|
19
|
-
"added to get it. Every observer below answers a Figure, never a number or a",
|
|
20
|
-
"Boolean: `A` means no and `B` means yes.",
|
|
21
|
-
"",
|
|
22
|
-
"30c was written against v0.16.0 and had to work around three behaviours that",
|
|
23
|
-
"v0.17.0 changes. Its observers needed a boxed if/else, they could not use local",
|
|
24
|
-
"names without writing onto the Figure observed, and identity-sameness was",
|
|
25
|
-
"unanswerable. Here each one is written plainly.",
|
|
26
|
-
"",
|
|
27
|
-
"The constructor is the bracket",
|
|
28
|
-
"```",
|
|
29
|
-
"; .A []; .B [A]; .C [B]; .D [C];",
|
|
30
|
-
"; .E [A, B]; .F [B, C]; .G [E, F];",
|
|
31
|
-
"; G",
|
|
32
|
-
"# [[[], [[]]], [[[]], [[[]]]]]",
|
|
33
|
-
"```",
|
|
34
|
-
"A named closure is the one-child form, so a Figure can receive a reduce. For n",
|
|
35
|
-
"children, write the bracket: a group passed to a closure stays one argument",
|
|
36
|
-
"```",
|
|
37
|
-
"; .Figure {[_]};",
|
|
38
|
-
"; Figure (B)",
|
|
39
|
-
"# [[[]]]",
|
|
40
|
-
"; Figure (B, A)",
|
|
41
|
-
"# [([[]], [])]",
|
|
42
|
-
"; [B, A]",
|
|
43
|
-
"# [[[]], []]",
|
|
44
|
-
"```",
|
|
45
|
-
"Manyness is a tally of the immediate children: one mark `B` for each child, so",
|
|
46
|
-
"a count is a row of marks rather than a nest of successors. It maps the children",
|
|
47
|
-
"and looks no deeper, so it needs no recursion and no way to take the rest of a",
|
|
48
|
-
"Figure",
|
|
49
|
-
"```",
|
|
50
|
-
"; .many {_ & {B}};",
|
|
51
|
-
"; many A",
|
|
52
|
-
"# []",
|
|
53
|
-
"; many B",
|
|
54
|
-
"# [[[]]]",
|
|
55
|
-
"; many E",
|
|
56
|
-
"# [[[]], [[]]]",
|
|
57
|
-
"; (many G) = (many E)",
|
|
58
|
-
"# <>",
|
|
59
|
-
"; (many E) = (many B)",
|
|
60
|
-
"# ()",
|
|
61
|
-
"```",
|
|
62
|
-
"Size is recursive cell volume, not immediate Manyness. `Z` reuses `A` as the",
|
|
63
|
-
"additive zero and `U` reuses `B` as the unit cell, the same mark Manyness uses.",
|
|
64
|
-
"Size answers a tally, one `U` for every unit cell, so a count is itself a Figure",
|
|
65
|
-
"of units, and the two observers agree on a flat row of units and part on",
|
|
66
|
-
"nesting. `cat` adds two tallies by reducing one into the other, which collects",
|
|
67
|
-
"into a fresh row and writes neither. `Tally` is a receiver that declares its own",
|
|
68
|
-
"application: each row applied to it is added to the row it holds. Size maps",
|
|
69
|
-
"every immediate child to its Size and reduces those into `Tally`. With no",
|
|
70
|
-
"children there is nothing to reduce, so the reduce answers `Tally` itself, whose",
|
|
71
|
-
"row is empty. The `U` case comes first because its child is `Z`. It tests form",
|
|
72
|
-
"with `=`, so any Figure shaped like `U` is a unit cell and equal-looking Figures",
|
|
73
|
-
"always have equal Size. HC supplies recursive control, child traversal, and",
|
|
74
|
-
"structural `=`; Size needs no identity, and every mathematical value below is",
|
|
75
|
-
"made only with the bracket Figure constructor",
|
|
76
|
-
"```",
|
|
77
|
-
"; .Z A; .U B;",
|
|
78
|
-
"; .cat {(_ .1) | (_ .0)};",
|
|
79
|
-
"; .Tally [.row Z; .apply_ {@row (cat [row, _]);}];",
|
|
80
|
-
"; .size {(_ = U) ? {[U]} : {((__ & {size _}) | Tally) .row}};",
|
|
81
|
-
"; size Z",
|
|
82
|
-
"# []",
|
|
83
|
-
"; size U",
|
|
84
|
-
"# [[[]]]",
|
|
85
|
-
"; (size [U]) = (size [[A]])",
|
|
86
|
-
"# <>",
|
|
87
|
-
"; .row4 [U, U, U, U];",
|
|
88
|
-
"; (size row4) = row4",
|
|
89
|
-
"# <>",
|
|
90
|
-
"; .deep4 [[[row4]]];",
|
|
91
|
-
"; (size deep4) = row4",
|
|
92
|
-
"# <>",
|
|
93
|
-
"; [(many row4) = (size row4), (many deep4) = (size deep4)]",
|
|
94
|
-
"# [<>, ()]",
|
|
95
|
-
"; .two_fours [row4, row4];",
|
|
96
|
-
"; size two_fours",
|
|
97
|
-
"# [[[]], [[]], [[]], [[]], [[]], [[]], [[]], [[]]]",
|
|
98
|
-
"; [(size two_fours) = (cat [row4, row4]), row4 = [U, U, U, U], many two_fours]",
|
|
99
|
-
"# [<>, <>, [[[]], [[]]]]",
|
|
100
|
-
"; Tally .row",
|
|
101
|
-
"# []",
|
|
102
|
-
"```",
|
|
103
|
-
"A tally is its own Size, so Size is idempotent: every count it answers",
|
|
104
|
-
"represents the class it names",
|
|
105
|
-
"```",
|
|
106
|
-
"; (size (size two_fours)) = (size two_fours)",
|
|
107
|
-
"# <>",
|
|
108
|
-
"```",
|
|
109
|
-
"The semiring carrier is not raw Figures under structural or identity equality.",
|
|
110
|
-
"Let `F` be the finite, well-founded Figures made with the bracket, with the",
|
|
111
|
-
"form of `U` as the unit cell, and write `x ≈ y` when `(size x) = (size y)`.",
|
|
112
|
-
"The carrier is the quotient `F/≈`; HC's structural `=` compares the tallies",
|
|
113
|
-
"Size answers. Because Size reads only form, `x = y` implies `x ≈ y`. Its zero",
|
|
114
|
-
"and one are `Z` and `U`. Addition constructs `Figure(x, y)`. Multiplication maps",
|
|
115
|
-
"every cell of `size x` to `y`, so a product reuses `y` once for every cell of",
|
|
116
|
-
"`x` while every result remains a Figure. A product by `Z` is `Z`, because one",
|
|
117
|
-
"row of nothing would be `[Z]`, which has the form of `U` and would count as a",
|
|
118
|
-
"cell. On tallies, `size_mul` is the same map followed by Size",
|
|
119
|
-
"```",
|
|
120
|
-
"; .figure_add {[(_ .0), (_ .1)]};",
|
|
121
|
-
"; .figure_mul {.y (_ .1); (y = Z) ? {Z} : {(size (__ .0)) & {y}}};",
|
|
122
|
-
"; .size_mul {size ((_ .0) & {__ .1})};",
|
|
123
|
-
"; .size_equivalent {((size (_ .0)) = (size (_ .1))) ? {U} : {Z}};",
|
|
124
|
-
"; [figure_mul [U, Z], size [Z]]",
|
|
125
|
-
"# [[], [[[]]]]",
|
|
126
|
-
"```",
|
|
127
|
-
"A non-square product is two occurrences of one three-cell row, and both",
|
|
128
|
-
"positions reuse the same `row3`. Manyness sees two rows, while Size counts six",
|
|
129
|
-
"unit cells",
|
|
130
|
-
"```",
|
|
131
|
-
"; .row2 [U, U]; .row3 [U, U, U];",
|
|
132
|
-
"; .rectangle23 (figure_mul [row2, row3]);",
|
|
133
|
-
"; rectangle23 = [row3, row3]",
|
|
134
|
-
"# <>",
|
|
135
|
-
"; [(rectangle23 .0) === row3, (rectangle23 .1) === row3]",
|
|
136
|
-
"# [<>, <>]",
|
|
137
|
-
"; size rectangle23",
|
|
138
|
-
"# [[[]], [[]], [[]], [[]], [[]], [[]]]",
|
|
139
|
-
"```",
|
|
140
|
-
"The defining equations are executable: Size takes Figure addition to `cat`,",
|
|
141
|
-
"and Figure multiplication to `size_mul`. Therefore both recipes respect `≈`;",
|
|
142
|
-
"the representative checks also use differently nested, equal-Size inputs",
|
|
143
|
-
"```",
|
|
144
|
-
"; [(size (figure_add [row2, row3])) = (cat [size row2, size row3]), (size rectangle23) = (size_mul [size row2, size row3])]",
|
|
145
|
-
"# [<>, <>]",
|
|
146
|
-
"; .deep2 [[row2]]; .deep3 [[[row3]]];",
|
|
147
|
-
"; [size_equivalent [row2, deep2], size_equivalent [row3, deep3], size_equivalent [figure_add [row2, row3], figure_add [deep2, deep3]], size_equivalent [figure_mul [row2, row3], figure_mul [deep2, deep3]]]",
|
|
148
|
-
"# [[[]], [[]], [[]], [[]]]",
|
|
149
|
-
"```",
|
|
150
|
-
"Tallies are the natural numbers in unary, one row of `n` units for each count",
|
|
151
|
-
"`n`, with `cat` as addition and `size_mul` as multiplication. Induction gives",
|
|
152
|
-
"additive identity, associativity and commutativity; multiplicative identity,",
|
|
153
|
-
"associativity and commutativity; both distributive laws; and both zero",
|
|
154
|
-
"annihilations. Transport along Size proves those laws on `F/≈`. The raw product",
|
|
155
|
-
"is not commutative: it maps over the Size of its left operand and reuses its",
|
|
156
|
-
"right operand whole, so `row2` by `row3` is two rows of three, `row3` by `row2`",
|
|
157
|
-
"is three rows of two, and they agree only in Size. These executed instances",
|
|
158
|
-
"witness every law without replacing the inductive proof",
|
|
159
|
-
"```",
|
|
160
|
-
"; [(figure_mul [row2, row3]) = (figure_mul [row3, row2]), size_equivalent [figure_mul [row2, row3], figure_mul [row3, row2]]]",
|
|
161
|
-
"# [(), [[]]]",
|
|
162
|
-
"; [size_equivalent [figure_add [Z, row2], row2], size_equivalent [figure_add [row2, Z], row2]]",
|
|
163
|
-
"# [[[]], [[]]]",
|
|
164
|
-
"; [size_equivalent [figure_mul [U, row2], row2], size_equivalent [figure_mul [row2, U], row2]]",
|
|
165
|
-
"# [[[]], [[]]]",
|
|
166
|
-
"; [size_equivalent [figure_add [figure_add [row2, row3], row4], figure_add [row2, figure_add [row3, row4]]], size_equivalent [figure_add [row2, row3], figure_add [row3, row2]]]",
|
|
167
|
-
"# [[[]], [[]]]",
|
|
168
|
-
"; size_equivalent [figure_mul [figure_mul [row2, row3], row4], figure_mul [row2, figure_mul [row3, row4]]]",
|
|
169
|
-
"# [[]]",
|
|
170
|
-
"; [size_equivalent [figure_mul [row2, figure_add [row3, row4]], figure_add [figure_mul [row2, row3], figure_mul [row2, row4]]], size_equivalent [figure_mul [figure_add [row2, row3], row4], figure_add [figure_mul [row2, row4], figure_mul [row3, row4]]]]",
|
|
171
|
-
"# [[[]], [[]]]",
|
|
172
|
-
"; [size_equivalent [figure_mul [Z, row3], Z], size_equivalent [figure_mul [row3, Z], Z]]",
|
|
173
|
-
"# [[[]], [[]]]",
|
|
174
|
-
"```",
|
|
175
|
-
"Sameness has two rungs. Sameness of form is `=`, and sameness of the",
|
|
176
|
-
"constructed Figure is `===`, which 30c recorded as unanswerable in v0.16.0",
|
|
177
|
-
"```",
|
|
178
|
-
"; .sameform {((_ .0) = (_ .1)) ? {B} : {A}};",
|
|
179
|
-
"; .sameness {((_ .0) === (_ .1)) ? {B} : {A}};",
|
|
180
|
-
"; sameform [B, [A]]",
|
|
181
|
-
"# [[]]",
|
|
182
|
-
"; sameness [B, B]",
|
|
183
|
-
"# [[]]",
|
|
184
|
-
"; sameness [B, [A]]",
|
|
185
|
-
"# []",
|
|
186
|
-
"; sameness [(E .0), A]",
|
|
187
|
-
"# [[]]",
|
|
188
|
-
"; .B2 [A];",
|
|
189
|
-
"; [B = B2, B == B2, B === B2]",
|
|
190
|
-
"# [<>, <>, ()]",
|
|
191
|
-
"```",
|
|
192
|
-
"Withness asks whether all requested Figures are immediate children of one",
|
|
193
|
-
"parent. It uses identity `===`, not equal-looking form: `B` is reused under both",
|
|
194
|
-
"`E` and `F`, while the separately constructed `B2` is not a child of either",
|
|
195
|
-
"```",
|
|
196
|
-
"; .absent {(figs & {(((parent & {(_ === __) ? {[<>]}}) | []) = []) ? {[<>]}}) | []};",
|
|
197
|
-
"; .withness {((absent _) = []) ? {B} : {A}};",
|
|
198
|
-
"; withness [.parent E; .figs [A, B];]",
|
|
199
|
-
"# [[]]",
|
|
200
|
-
"; withness [.parent F; .figs [A, B];]",
|
|
201
|
-
"# []",
|
|
202
|
-
"; withness [.parent G; .figs [E, F];]",
|
|
203
|
-
"# [[]]",
|
|
204
|
-
"; withness [.parent E; .figs [B2];]",
|
|
205
|
-
"# []",
|
|
206
|
-
"```",
|
|
207
|
-
"Both edges follow from the empty reduce answering its receiver. An empty parent",
|
|
208
|
-
"holds nothing, so no Figure is with it; and every one of no Figures is a child of",
|
|
209
|
-
"any parent, so asking about none answers yes",
|
|
210
|
-
"```",
|
|
211
|
-
"; [withness [.parent A; .figs [B];], withness [.parent B; .figs [];]]",
|
|
212
|
-
"# [[], [[]]]",
|
|
213
|
-
"```",
|
|
214
|
-
"The Fano construction starts with seven Figures of identical form: each original",
|
|
215
|
-
"is a fresh `[]`, so all seven triples below have the same form `[[], [], []]`.",
|
|
216
|
-
"The incidence pattern lives only in which originals each triple reuses, and",
|
|
217
|
-
"Withness checks that common immediate containment by identity. Under structural",
|
|
218
|
-
"`=` every original would be a child of every triple. `b_copy` is one more fresh",
|
|
219
|
-
"`[]`, equal in form to every original and a child of no triple",
|
|
220
|
-
"```",
|
|
221
|
-
"; .a []; .b []; .c []; .d []; .e []; .f []; .g [];",
|
|
222
|
-
"; .originals [a, b, c, d, e, f, g];",
|
|
223
|
-
"; .abd [a, b, d]; .bce [b, c, e]; .cdf [c, d, f];",
|
|
224
|
-
"; .deg [d, e, g]; .efa [e, f, a]; .fgb [f, g, b]; .gac [g, a, c];",
|
|
225
|
-
"; .fano [abd, bce, cdf, deg, efa, fgb, gac];",
|
|
226
|
-
"; .Three [U, U, U];",
|
|
227
|
-
"; [many originals, (many originals) = (many fano)]",
|
|
228
|
-
"# [[[[]], [[]], [[]], [[]], [[]], [[]], [[]]], <>]",
|
|
229
|
-
"; (fano & {many _}) = (fano & {Three})",
|
|
230
|
-
"# <>",
|
|
231
|
-
"; [abd = bce, abd === bce]",
|
|
232
|
-
"# [<>, ()]",
|
|
233
|
-
"; [sameform [a, b], sameness [a, b], sameness [b, b]]",
|
|
234
|
-
"# [[[]], [], [[]]]",
|
|
235
|
-
"; .b_copy [];",
|
|
236
|
-
"; b = b_copy",
|
|
237
|
-
"# <>",
|
|
238
|
-
"; sameness [b, b_copy]",
|
|
239
|
-
"# []",
|
|
240
|
-
"; withness [.parent abd; .figs [a, b, d];]",
|
|
241
|
-
"# [[]]",
|
|
242
|
-
"; withness [.parent abd; .figs [a, c];]",
|
|
243
|
-
"# []",
|
|
244
|
-
"; withness [.parent abd; .figs [b_copy];]",
|
|
245
|
-
"# []",
|
|
246
|
-
"```",
|
|
247
|
-
"Incidence is a table. `on` answers, for each triple, whether it holds every",
|
|
248
|
-
"requested original, so its Size counts the triples that do. `point_table`",
|
|
249
|
-
"applies it to every ordered pair of originals, generated with the Cartesian",
|
|
250
|
-
"idiom of 005.30b rather than listed, so the check is exhaustive by",
|
|
251
|
-
"construction. Two distinct originals lie in exactly one triple, and each",
|
|
252
|
-
"original lies in three",
|
|
253
|
-
"```",
|
|
254
|
-
"; .on {fano & {withness [.parent _; .figs __;]}};",
|
|
255
|
-
"; .point_table (originals & {.p _; originals & {size (on [p, _])}});",
|
|
256
|
-
"; point_table = (originals & {.p _; originals & {(p === _) ? {Three} : {[U]}}})",
|
|
257
|
-
"# <>",
|
|
258
|
-
"```",
|
|
259
|
-
"Dually, `meet` counts the originals two triples share. For each original,",
|
|
260
|
-
"multiplying its two Figure-valued Withness answers leaves one cell exactly when",
|
|
261
|
-
"both triples hold it. Two distinct triples share exactly one original, and each",
|
|
262
|
-
"triple holds three. The two tables are equal, which is the plane's",
|
|
263
|
-
"self-duality",
|
|
264
|
-
"```",
|
|
265
|
-
"; .meet {size (originals & {figure_mul [withness [.parent (__ .0); .figs [_];], withness [.parent (__ .1); .figs [_];]]})};",
|
|
266
|
-
"; .line_table (fano & {.l _; fano & {meet [l, _]}});",
|
|
267
|
-
"; line_table = (fano & {.l _; fano & {(l === _) ? {Three} : {[U]}}})",
|
|
268
|
-
"# <>",
|
|
269
|
-
"; point_table = line_table",
|
|
270
|
-
"# <>",
|
|
271
|
-
"```",
|
|
272
|
-
"Finally `a, b, c, f` are four originals with no three in a triple. All four of",
|
|
273
|
-
"their 3-subsets are listed, and no triple holds any of them",
|
|
274
|
-
"```",
|
|
275
|
-
"; [[a, b, c], [a, b, f], [a, c, f], [b, c, f]] & {size (on _)}",
|
|
276
|
-
"# [[], [], [], []]",
|
|
277
|
-
"```",
|
|
278
|
-
"Both results use the bracket as their sole `Figure(children...)` constructor.",
|
|
279
|
-
"HC, not the Figure theory, supplies child addressing and `&`/`|` traversal,",
|
|
280
|
-
"closure calls, recursion and conditional control, fresh aggregate allocation,",
|
|
281
|
-
"reference reuse and copy-on-write behavior, structural `=`, and identity",
|
|
282
|
-
"`===`. The corpus derives Manyness, Size, Size-equivalence, the Figure-valued",
|
|
283
|
-
"operations, Sameness, Withness, and the finite incidence checks from those",
|
|
284
|
-
"services. The semiring uses only form; identity enters where the Fano pattern",
|
|
285
|
-
"needs it, in Sameness and Withness. Multiplication invokes no copy primitive:",
|
|
286
|
-
"its identity assertions show that it reuses `row3`. `b_copy` is a fresh bracket",
|
|
287
|
-
"construction, not a derived copy operation. Neither the semiring laws nor the",
|
|
288
|
-
"Fano pattern is claimed for arbitrary Figure observations outside the stated",
|
|
289
|
-
"quotient and construction.",
|
|
290
|
-
"Observation does not mutate, even with a local name inside a map",
|
|
291
|
-
"```",
|
|
292
|
-
"; E = [A, B]",
|
|
293
|
-
"# <>",
|
|
294
|
-
"; .E5 [A, [A]];",
|
|
295
|
-
"; E5 & {.o _; o};",
|
|
296
|
-
"; E5",
|
|
297
|
-
"# [[], [[]]]",
|
|
298
|
-
"; A",
|
|
299
|
-
"# []",
|
|
300
|
-
"```",
|
|
301
|
-
"005.30b's Cartesian product, executed verbatim. The grid is one source element,",
|
|
302
|
-
"so `Figure` is applied once and the answer has the grid as its sole child",
|
|
303
|
-
"```",
|
|
304
|
-
"; .Pa [“a”, “b”]; .Pb [“c”, “d”];",
|
|
305
|
-
"; [(Pa & { Pb & { [__, _] } })] | Figure",
|
|
306
|
-
"# [[[[“a”, “c”], [“a”, “d”]], [[“b”, “c”], [“b”, “d”]]]]",
|
|
307
|
-
"; (many ([(Pa & { Pb & { [__, _] } })] | Figure)) = [U]",
|
|
308
|
-
"# <>",
|
|
309
|
-
"; (([(Pa & { Pb & { [__, _] } })] | Figure) .0) = (Pa & { Pb & { [__, _] } })",
|
|
310
|
-
"# <>",
|
|
311
|
-
"; (many (Pa & { Pb & { [__, _] } })) = [U, U]",
|
|
312
|
-
"# <>",
|
|
313
|
-
"",
|
|
314
|
-
].join("\n"),
|
|
315
|
-
],
|
|
316
|
-
]);
|