hclang 0.26.0 → 0.26.2
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.
|
@@ -1176,14 +1176,19 @@ export const HC_SOURCES = new Map([
|
|
|
1176
1176
|
"",
|
|
1177
1177
|
"Three observers share one form: a stream, a mark for each thing in it, and one",
|
|
1178
1178
|
"construction. Manyness marks each child, Size marks each cell, and",
|
|
1179
|
-
"Multiplication puts y at each cell.
|
|
1180
|
-
"
|
|
1179
|
+
"Multiplication puts y at each cell. They are fewer than three constructions:",
|
|
1180
|
+
"Size is Multiplication by the unit, and Tally multiplication is Multiplication",
|
|
1181
|
+
"of a Manyness, so Multiplication holds the only zero guard. No observer",
|
|
1182
|
+
"computes: an observer may count, and may construct n things for a count n, but",
|
|
1183
|
+
"it never does arithmetic on counts (#435). A tally reads as a number because",
|
|
1184
|
+
"its children are an aggregate, so",
|
|
1181
1185
|
"`(x.size()).children.#` is the FrameCount it spells, as `(x.cells()).#` is, and",
|
|
1182
1186
|
"`x.children.#` counts x's children. A Figure's own `.#` and `.##` are `0`,",
|
|
1183
1187
|
"because its children are a property rather than its elements (#407, #411).",
|
|
1184
|
-
"
|
|
1185
|
-
"
|
|
1186
|
-
"
|
|
1188
|
+
"v0.22.0 counted cells and built from the count, but Tally multiplication also",
|
|
1189
|
+
"multiplied two counts (#414). v0.24.0 removed the counting along with the",
|
|
1190
|
+
"arithmetic (#415), and v0.26.2 restores the counting alone (#435). Before",
|
|
1191
|
+
"v0.22.0, Size joined its children's Sizes one unit at a time through a helper.",
|
|
1187
1192
|
"",
|
|
1188
1193
|
"Three Figures play the roles of zero and one, and keeping them apart is what",
|
|
1189
1194
|
"the guards below are for. `Z` is zero. `U` is the unit cell that Size counts.",
|
|
@@ -1217,33 +1222,38 @@ export const HC_SOURCES = new Map([
|
|
|
1217
1222
|
" .many {Figure (_^.children & {B})};",
|
|
1218
1223
|
"```",
|
|
1219
1224
|
"**Size**, `x.size()`: a tally with one unit cell `U` per cell, as Manyness has",
|
|
1220
|
-
"one mark per child.
|
|
1221
|
-
"reuse and
|
|
1225
|
+
"one mark per child. That is Multiplication by `U`, which puts a `U` at every",
|
|
1226
|
+
"cell. It keeps the cell count and forgets shape, nesting, order, reuse and",
|
|
1227
|
+
"identity",
|
|
1222
1228
|
"```;",
|
|
1223
|
-
" .size {
|
|
1229
|
+
" .size {_^.mul U};",
|
|
1224
1230
|
"```",
|
|
1225
1231
|
"**Cells**, `x.cells()`: the cells of x, in order, each one itself. Any Figure",
|
|
1226
1232
|
"shaped like `U` is a cell, and every other Figure's cells are its children's,",
|
|
1227
1233
|
"spliced into one array by `&|` (#421). The unit case comes first, because a",
|
|
1228
|
-
"unit's only child is `Z`.
|
|
1229
|
-
"
|
|
1230
|
-
"
|
|
1234
|
+
"unit's only child is `Z`. When every child is already a cell, the cells are the",
|
|
1235
|
+
"children themselves. Cells sees that by comparing the children with as many",
|
|
1236
|
+
"units, which counts rather than walks, so a tally answers at once. It keeps the",
|
|
1237
|
+
"cells and their order, and forgets where they were. A block in a method counts",
|
|
1238
|
+
"carets lexically, so the cell itself is `_^^` inside the branch",
|
|
1231
1239
|
"```;",
|
|
1232
1240
|
" .cells {.kids _^.children;",
|
|
1233
|
-
" (kids = U.children) ? {[_^^]} : {kids &| {_.cells()}}};",
|
|
1241
|
+
" (kids = U.children) ? {[_^^]} : {(kids = ((kids.#) [U])) ? {kids} : {kids &| {_.cells()}}}};",
|
|
1234
1242
|
"```",
|
|
1235
1243
|
"**Multiplication**, `x.mul y`: y at every cell of x, and `Z` when y is `Z`. It",
|
|
1236
|
-
"
|
|
1237
|
-
"
|
|
1244
|
+
"counts x's cells and constructs y that many times, so it keeps y's identity in",
|
|
1245
|
+
"every position and forgets x's shape. Without the guard, a one-cell x would",
|
|
1246
|
+
"answer `Figure [Z]`, which is a cell rather than zero",
|
|
1238
1247
|
"```;",
|
|
1239
|
-
" .mul {.y _; .
|
|
1248
|
+
" .mul {.y _; .n ((_^.cells()).#); (y = Z) ? {Z} : {Figure (n [y])}};",
|
|
1240
1249
|
"```",
|
|
1241
1250
|
"**Tally multiplication**, `x.size_mul y`: the Size of a Figure holding y once",
|
|
1242
|
-
"per child of x, and `Z` when y is `Z
|
|
1243
|
-
"
|
|
1251
|
+
"per child of x, and `Z` when y is `Z`. Manyness marks each child with `B`,",
|
|
1252
|
+
"which is `U`, so it is a tally of the children, and multiplying it by y holds y",
|
|
1253
|
+
"once per child. Multiplication's guard answers `Z` for a zero factor, so this",
|
|
1254
|
+
"needs no guard of its own. It keeps the cell count and forgets both shapes",
|
|
1244
1255
|
"```;",
|
|
1245
|
-
" .size_mul {.
|
|
1246
|
-
" (y = Z) ? {Z} : {(Figure (kids & {y})).size()}};",
|
|
1256
|
+
" .size_mul {((_^.many()).mul _).size()};",
|
|
1247
1257
|
"```",
|
|
1248
1258
|
"**Size-equivalence**, `x.size_equivalent y`: `U` when the two Sizes are the",
|
|
1249
1259
|
"same tally and `Z` otherwise. It keeps only whether the cell counts agree",
|
|
@@ -1266,9 +1276,7 @@ export const HC_SOURCES = new Map([
|
|
|
1266
1276
|
"them. A requested Figure is absent when no child is identical to it",
|
|
1267
1277
|
"```;",
|
|
1268
1278
|
" .withness {.kids _^.children;",
|
|
1269
|
-
" .absent (
|
|
1270
|
-
" .found ((kids & {(_ === f) ? {f}}) | []);",
|
|
1271
|
-
" (found = []) ? {f}}) | []);",
|
|
1279
|
+
" .absent (_ &| {.f _; ((kids &| {(_ === f) ? {[f]}}) = []) ? {[f]}});",
|
|
1272
1280
|
" (absent = []) ? {B} : {A}};",
|
|
1273
1281
|
"```",
|
|
1274
1282
|
"**Form**, `x.form()`: the plain bracket tree of x, one bracket per Figure, the",
|
|
@@ -1343,7 +1351,7 @@ export const HC_SOURCES = new Map([
|
|
|
1343
1351
|
"quick, and the receiver and every child keep their identity. Each step still",
|
|
1344
1352
|
"copies the children it has so far, because a collect through a name always lands",
|
|
1345
1353
|
"on a fresh array (#386). That keeps a join quadratic in pointer copies, about",
|
|
1346
|
-
"0.
|
|
1354
|
+
"0.2 s for 4,096 units, and the observers never join: they construct from a",
|
|
1347
1355
|
"stream in one step (#415)",
|
|
1348
1356
|
"```",
|
|
1349
1357
|
"; .joined ((512 [U]) | Z);",
|
|
@@ -1378,8 +1386,8 @@ export const HC_SOURCES = new Map([
|
|
|
1378
1386
|
"Tallies add without a helper: the Size of a Figure holding two tallies joins",
|
|
1379
1387
|
"them, and two `Z`s add to `Z`. Add two at a time, because two children are",
|
|
1380
1388
|
"never shaped like `U`. One child can be: `Figure [Z]` has the form of `U`, so",
|
|
1381
|
-
"its Size is one cell, the rule that makes Multiplication
|
|
1382
|
-
"
|
|
1389
|
+
"its Size is one cell, the rule that makes Multiplication guard `Z`, for",
|
|
1390
|
+
"itself and for Tally multiplication",
|
|
1383
1391
|
"```",
|
|
1384
1392
|
"; [((Figure [row2, row3]).size()) = (row3.children | row2), ((Figure [Z, Z]).size()) = Z, ((Figure [Z]).size()) = (Figure [U])]",
|
|
1385
1393
|
"# [<>, <>, <>]",
|
|
@@ -1410,6 +1418,23 @@ export const HC_SOURCES = new Map([
|
|
|
1410
1418
|
"; [E.children.#, (E.many()).children.#, (two_fours.size()).children.#, E.#, E.##, E.children.##] = [2, 2, 8, 0, 0, 0]",
|
|
1411
1419
|
"# <>",
|
|
1412
1420
|
"```",
|
|
1421
|
+
"A tally built by repetition is its own cells and its own Size, and every cell",
|
|
1422
|
+
"is `U` itself. Multiplication of it constructs y once per cell, each one y",
|
|
1423
|
+
"itself. A Figure whose children are not all cells is still walked",
|
|
1424
|
+
"```",
|
|
1425
|
+
"; .rep (Figure (6 [U]));",
|
|
1426
|
+
"; [(rep.cells()) = rep.children, ((rep.cells()) .5) === U, (rep.size()) = rep, (rep.mul row2) = (Figure (6 [row2])), ((rep.mul row2).children .5) === row2]",
|
|
1427
|
+
"# [<>, <>, <>, <>, <>]",
|
|
1428
|
+
"; [((Figure [row2, U]).cells()) = [U, U, U], (((Figure [row2, U]).cells()) .2) === U]",
|
|
1429
|
+
"# [<>, <>]",
|
|
1430
|
+
"```",
|
|
1431
|
+
"Zero is a quotient of zeros. A Figure made of nothing, or of several nothings,",
|
|
1432
|
+
"has no cells and a Size of `Z`'s form, but it is not `Z`, and it keeps its own",
|
|
1433
|
+
"form",
|
|
1434
|
+
"```",
|
|
1435
|
+
"; [((Figure [Z, Z]).cells()) = [], ((Figure [Z, Z]).size()) = Z, (Figure (0 [U])) = Z, (Figure (0 [U])) === Z, (Figure [Z, Z]) = Z]",
|
|
1436
|
+
"# [<>, <>, <>, (), ()]",
|
|
1437
|
+
"```",
|
|
1413
1438
|
"Cells answers the cells themselves, in order, wherever they were nested, and",
|
|
1414
1439
|
"`.#` reads how many there are, as it reads a tally",
|
|
1415
1440
|
"```",
|
|
@@ -1463,6 +1488,14 @@ export const HC_SOURCES = new Map([
|
|
|
1463
1488
|
"; [((Figure [row2, row3]).size()) = (Figure [U, U, U, U, U]), (rectangle23.size()) = ((row2.size()).size_mul (row3.size()))]",
|
|
1464
1489
|
"# [<>, <>]",
|
|
1465
1490
|
"```",
|
|
1491
|
+
"Size is Multiplication by the unit, and Tally multiplication is Multiplication",
|
|
1492
|
+
"of a Manyness, whatever the nesting",
|
|
1493
|
+
"```",
|
|
1494
|
+
"; [(row2.size()) = (row2.mul U), (deep4.size()) = (deep4.mul U), (Z.size()) = (Z.mul U)]",
|
|
1495
|
+
"# [<>, <>, <>]",
|
|
1496
|
+
"; [(row2.size_mul row3) = (((row2.many()).mul row3).size()), (deep4.size_mul row3) = (((deep4.many()).mul row3).size())]",
|
|
1497
|
+
"# [<>, <>]",
|
|
1498
|
+
"```",
|
|
1466
1499
|
"At a zero factor both recipes answer `Z`, a one-cell factor included",
|
|
1467
1500
|
"```",
|
|
1468
1501
|
"; [(U.size_mul Z) = Z, ((Figure [U]).size_mul Z) = Z, ((U.mul Z).size()) = ((U.size()).size_mul (Z.size()))]",
|
|
@@ -1577,6 +1610,15 @@ export const HC_SOURCES = new Map([
|
|
|
1577
1610
|
"; [E5 = (Figure [A, B]), A = (Figure [])]",
|
|
1578
1611
|
"# [<>, <>]",
|
|
1579
1612
|
"```",
|
|
1613
|
+
"## Reading the methods",
|
|
1614
|
+
"",
|
|
1615
|
+
"A method read through a Figure walks as the atoms of its body, unevaluated",
|
|
1616
|
+
"(#429), so the module can read what an observer is built from. Size is",
|
|
1617
|
+
"Multiplication by the unit, and its body says so",
|
|
1618
|
+
"```",
|
|
1619
|
+
"; (E.size) & {“” _}",
|
|
1620
|
+
"# [“_^”, “.mul”, “U”]",
|
|
1621
|
+
"```",
|
|
1580
1622
|
"## Names",
|
|
1581
1623
|
"",
|
|
1582
1624
|
"A bare name inside a block that a map applies to Figures reads each Figure's",
|
|
@@ -82,6 +82,14 @@ export class BoundMethod extends Frame {
|
|
|
82
82
|
value: lexicalContext
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* A method walks as its closure does, the atoms of its body (#429), so a
|
|
87
|
+
* method read through its receiver, `e.cells`, can be inspected without
|
|
88
|
+
* being called. The receiver is not an atom, and the walk never reaches it.
|
|
89
|
+
*/
|
|
90
|
+
elements() {
|
|
91
|
+
return this.method.elements();
|
|
92
|
+
}
|
|
85
93
|
/** Whether this method was declared to mutate the frame it runs against. */
|
|
86
94
|
isMutating() {
|
|
87
95
|
return this.effect.mutating;
|
|
@@ -40,7 +40,15 @@ export class FrameLiteral extends FrameAtom {
|
|
|
40
40
|
});
|
|
41
41
|
this.is.declaration = true;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* The echo's text, rendered the first time it is asked for. Rendering it at
|
|
45
|
+
* declaration spelled out the whole declared value every time, and the echo
|
|
46
|
+
* is rarely printed: a Figure built from 16,384 children rendered all of
|
|
47
|
+
* them, each with its methods, and spent most of its time there (#435).
|
|
48
|
+
*/
|
|
43
49
|
toData() {
|
|
50
|
+
if (typeof this.data !== "string")
|
|
51
|
+
this.data = this.data();
|
|
44
52
|
return this.data;
|
|
45
53
|
}
|
|
46
54
|
/**
|
|
@@ -212,7 +220,7 @@ export class FrameSymbol extends FrameAtom {
|
|
|
212
220
|
if (refused)
|
|
213
221
|
return refused;
|
|
214
222
|
return previous.is.missing
|
|
215
|
-
? new FrameLiteral(`.^ ${argument.toString()}`)
|
|
223
|
+
? new FrameLiteral(() => `.^ ${argument.toString()}`)
|
|
216
224
|
: argument;
|
|
217
225
|
}
|
|
218
226
|
const binding = out.resolve_here(this.data, out);
|
|
@@ -234,7 +242,7 @@ export class FrameSymbol extends FrameAtom {
|
|
|
234
242
|
}
|
|
235
243
|
out.set(assignmentKey, argument);
|
|
236
244
|
return previous.is.missing
|
|
237
|
-
? new FrameLiteral(`.${this.data} ${argument.toString()}`, {
|
|
245
|
+
? new FrameLiteral(() => `.${this.data} ${argument.toString()}`, {
|
|
238
246
|
target: out,
|
|
239
247
|
key: assignmentKey,
|
|
240
248
|
value: argument,
|
|
@@ -265,7 +273,7 @@ export class FrameSymbol extends FrameAtom {
|
|
|
265
273
|
}
|
|
266
274
|
out.set(assignmentKey, schema);
|
|
267
275
|
out.set(`${assignmentKey}.<>`, schema);
|
|
268
|
-
return new FrameLiteral(`.${this.data} ${schema.toString()}`, {
|
|
276
|
+
return new FrameLiteral(() => `.${this.data} ${schema.toString()}`, {
|
|
269
277
|
target: out,
|
|
270
278
|
key: assignmentKey,
|
|
271
279
|
value: schema,
|
package/esm/lib/ops/iterators.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Frame } from "../frames/frame.js";
|
|
3
3
|
import { FrameArray } from "../frames/frame-array.js";
|
|
4
4
|
import { FrameSymbol } from "../frames/frame-symbol.js";
|
|
5
|
+
import { BoundMethod } from "../frames/bound-method.js";
|
|
5
6
|
import { FrameLazy } from "../frames/frame-lazy.js";
|
|
6
7
|
import { FrameList } from "../frames/frame-list.js";
|
|
7
8
|
import { FrameWord } from "../frames/frame-word.js";
|
|
@@ -68,7 +69,7 @@ export const SpliceElements = (source, receiver, receiverState) => new FrameArra
|
|
|
68
69
|
*/
|
|
69
70
|
export const ReduceElements = (source, receiver, receiverState) => {
|
|
70
71
|
const code = source.referent();
|
|
71
|
-
if (code instanceof FrameLazy) {
|
|
72
|
+
if (code instanceof FrameLazy || code instanceof BoundMethod) {
|
|
72
73
|
return code.call(receiver, Frame.nil, receiverState);
|
|
73
74
|
}
|
|
74
75
|
// Only an aggregate is inspected: a stream's elements are produced by
|
package/esm/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.26.
|
|
1
|
+
export const VERSION = "0.26.2";
|