hclang 0.26.1 → 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.
@@ -1178,14 +1178,17 @@ export const HC_SOURCES = new Map([
1178
1178
  "construction. Manyness marks each child, Size marks each cell, and",
1179
1179
  "Multiplication puts y at each cell. They are fewer than three constructions:",
1180
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 counts. A number appears only",
1182
- "when a tally is read as one: its children are an aggregate, so",
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",
1183
1185
  "`(x.size()).children.#` is the FrameCount it spells, as `(x.cells()).#` is, and",
1184
1186
  "`x.children.#` counts x's children. A Figure's own `.#` and `.##` are `0`,",
1185
1187
  "because its children are a property rather than its elements (#407, #411).",
1186
- "Before v0.24.0 Size, Multiplication and Tally multiplication counted cells",
1187
- "natively and built from the count (#414), and before v0.22.0 Size joined its",
1188
- "children's Sizes one unit at a time through a helper (#415).",
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.",
1189
1192
  "",
1190
1193
  "Three Figures play the roles of zero and one, and keeping them apart is what",
1191
1194
  "the guards below are for. `Z` is zero. `U` is the unit cell that Size counts.",
@@ -1228,18 +1231,21 @@ export const HC_SOURCES = new Map([
1228
1231
  "**Cells**, `x.cells()`: the cells of x, in order, each one itself. Any Figure",
1229
1232
  "shaped like `U` is a cell, and every other Figure's cells are its children's,",
1230
1233
  "spliced into one array by `&|` (#421). The unit case comes first, because a",
1231
- "unit's only child is `Z`. It keeps the cells and their order, and forgets where",
1232
- "they were. A block in a method counts carets lexically, so the cell itself is",
1233
- "`_^^` inside the branch",
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",
1234
1239
  "```;",
1235
1240
  " .cells {.kids _^.children;",
1236
- " (kids = U.children) ? {[_^^]} : {kids &| {_.cells()}}};",
1241
+ " (kids = U.children) ? {[_^^]} : {(kids = ((kids.#) [U])) ? {kids} : {kids &| {_.cells()}}}};",
1237
1242
  "```",
1238
1243
  "**Multiplication**, `x.mul y`: y at every cell of x, and `Z` when y is `Z`. It",
1239
- "keeps y's identity in every position, and it forgets x's shape. Without the",
1240
- "guard, a one-cell x would answer `Figure [Z]`, which is a cell rather than zero",
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",
1241
1247
  "```;",
1242
- " .mul {.y _; .cells _^.cells(); (y = Z) ? {Z} : {Figure (cells & {y})}};",
1248
+ " .mul {.y _; .n ((_^.cells()).#); (y = Z) ? {Z} : {Figure (n [y])}};",
1243
1249
  "```",
1244
1250
  "**Tally multiplication**, `x.size_mul y`: the Size of a Figure holding y once",
1245
1251
  "per child of x, and `Z` when y is `Z`. Manyness marks each child with `B`,",
@@ -1345,7 +1351,7 @@ export const HC_SOURCES = new Map([
1345
1351
  "quick, and the receiver and every child keep their identity. Each step still",
1346
1352
  "copies the children it has so far, because a collect through a name always lands",
1347
1353
  "on a fresh array (#386). That keeps a join quadratic in pointer copies, about",
1348
- "0.9 s for 4,096 units, and the observers never join: they construct from a",
1354
+ "0.2 s for 4,096 units, and the observers never join: they construct from a",
1349
1355
  "stream in one step (#415)",
1350
1356
  "```",
1351
1357
  "; .joined ((512 [U]) | Z);",
@@ -1412,6 +1418,23 @@ export const HC_SOURCES = new Map([
1412
1418
  "; [E.children.#, (E.many()).children.#, (two_fours.size()).children.#, E.#, E.##, E.children.##] = [2, 2, 8, 0, 0, 0]",
1413
1419
  "# <>",
1414
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
+ "```",
1415
1438
  "Cells answers the cells themselves, in order, wherever they were nested, and",
1416
1439
  "`.#` reads how many there are, as it reads a tally",
1417
1440
  "```",
@@ -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,
@@ -1 +1 @@
1
- export const VERSION = "0.26.1";
1
+ export const VERSION = "0.26.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hclang",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "description": "Homoiconic C command-line interpreter and REPL",
5
5
  "keywords": [
6
6
  "language",