hclang 0.31.0 → 0.32.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.
@@ -1303,6 +1303,33 @@ export const HC_SOURCES = new Map([
1303
1303
  " .signed (alt kids);",
1304
1304
  " (signed .< 0) ? {0 - signed} : {signed}};",
1305
1305
  "```",
1306
+ "**Spin**, `x.spin N`: the signed alternating sum of the Sizes of x's immediate",
1307
+ "children, `Size(F₁) − Size(F₂) + Size(F₃) − …`, divided by a positive integer",
1308
+ "resolution N, read as an exact FrameRational in revolutions (#447). It folds the",
1309
+ "same readings Gap does, in the same order and with the same alternating signs",
1310
+ "that start positive, but it keeps the sign Gap drops, so the two directions read",
1311
+ "as `−` and `+`; the empty Figure has Spin `0` at every N. The signed sum is a",
1312
+ "whole count of revolutions, and `signed / N` divides it into N-ths, which the",
1313
+ "divisor's rung makes an exact ratio that collapses to a whole FrameInt when N",
1314
+ "divides it (#445, FrameCount). Gap is `|signed|`; Spin is `signed / N`, so Spin",
1315
+ "at N and Gap read the same fold and never disagree, and neither constructs: a",
1316
+ "zero Spin is an observed value, not a Fact that a Walk closed. N must be a",
1317
+ "count, bound as `.n <~~1>`, the count type read off a literal, so a non-count N",
1318
+ "— a fraction, a float, a negative, a string — is refused with a native",
1319
+ "`$!.type-error` before any fold, and the observable never answers a sign-flipped",
1320
+ "ratio for a negative N. A count N must also be positive: `N=0` passes the count",
1321
+ "type and is then the native `$!.division-by-zero`, and an empty argument `()`",
1322
+ "binds nothing and falls through to the same division-by-zero. `_^` names the",
1323
+ "receiver so the fold can read the children in order, and N is bound as `n`",
1324
+ "before the fold reads it",
1325
+ "```;",
1326
+ " .spin {.n <~~1> _; .kids _^.children;",
1327
+ " .count {(_.size()).children.#};",
1328
+ " .tail {(_ && {(((_ .0) = .0) ? {[()]} : {[[__ .1]]}) .0}) &| {_}};",
1329
+ " .alt {.cs _; (cs = []) ? {0} : {(count (cs .0)) - (alt (tail cs))}};",
1330
+ " .signed (alt kids);",
1331
+ " (n .< 1) ? {signed / 0} : {signed / n}};",
1332
+ "```",
1306
1333
  "**Form**, `x.form()`: the plain bracket tree of x, one bracket per Figure, the",
1307
1334
  "way 005.30c wrote Figures before they were a class. It keeps shape and order,",
1308
1335
  "and forgets identity and the methods",
@@ -1611,6 +1638,72 @@ export const HC_SOURCES = new Map([
1611
1638
  "; [((Figure [deep4, row2, row3]).gap()) = ((Figure [row4, row2, row3]).gap()), ((Figure [Z, U]).gap()) = 1]",
1612
1639
  "# [<>, <>]",
1613
1640
  "```",
1641
+ "## Spin",
1642
+ "",
1643
+ "Spin folds the same Sizes Gap does, in the same order with the same signs that",
1644
+ "start positive, but keeps the sign and divides by a positive resolution N,",
1645
+ "answering an exact FrameRational in revolutions. The division selects its rung",
1646
+ "from the divisor, so `signed / N` is a ratio that collapses to a whole FrameInt",
1647
+ "when N divides it, and a positive reading prints without a `+`. The same three",
1648
+ "children of Sizes 2, 5 and 3 whose Gap is `0` have Spin `0` at every N, and",
1649
+ "reversing the two children of a two-child Figure flips the sign: `(2,5)` reads",
1650
+ "`−3/4` and `(5,2)` reads `+3/4` at N=4. The Sizes come from ordinary Figures,",
1651
+ "`row5` of Size 5 above among them, and `Figure [U, Z, U]` has children of Sizes",
1652
+ "1, 0 and 1",
1653
+ "```",
1654
+ "; [((Figure [row2, row5, row3]).spin 4) = 0, ((Figure [row2, row5]).spin 4) = (0 - (3 / 4)), ((Figure [row5, row2]).spin 4) = (3 / 4), ((Figure [U, Z, U]).spin 4) = (1 / 2)]",
1655
+ "# [<>, <>, <>, <>]",
1656
+ "```",
1657
+ "Spin reads each child's Size the way Gap does, so it equals the signed fold",
1658
+ "divided by N, and Gap is its absolute value: the two observers never disagree on",
1659
+ "the same fold",
1660
+ "```",
1661
+ "; [((Figure [row2, row5]).spin 4) = ((((row2.size()).children.#) - ((row5.size()).children.#)) / 4), ((Figure [row5, row2]).spin 4) = (((Figure [row5, row2]).gap()) / 4), ((Figure [row2, row5]).spin 4) = (0 - (((Figure [row2, row5]).gap()) / 4))]",
1662
+ "# [<>, <>, <>]",
1663
+ "```",
1664
+ "The resolution N scales the same signed sum, and `N=1` reads whole signed",
1665
+ "revolutions, so `(2,5)` is `−3` at N=1, `−1` at N=3, and `(5,2)` is `+3/2` at",
1666
+ "N=2. Every reading is exact, keeping both direction and resolution",
1667
+ "```",
1668
+ "; [((Figure [row2, row5]).spin 1) = (0 - 3), ((Figure [row2, row5]).spin 3) = (0 - 1), ((Figure [row5, row2]).spin 2) = (3 / 2)]",
1669
+ "# [<>, <>, <>]",
1670
+ "```",
1671
+ "Spin keeps the sign Gap drops, so a one-child Figure reads its child's Size as a",
1672
+ "positive reading, the empty Figure reads `0` at every N, and nesting reaches a",
1673
+ "child only through its Size: `deep4` contributes 4 just as `row4` does",
1674
+ "```",
1675
+ "; [((Figure [row2]).spin 1) = 2, ((Figure [row2]).spin 4) = (1 / 2), (A.spin 4) = 0, (A.spin 1) = 0]",
1676
+ "# [<>, <>, <>, <>]",
1677
+ "; [((Figure [deep4, row2, row3]).spin 4) = ((Figure [row4, row2, row3]).spin 4), ((Figure [Z, U]).spin 4) = (0 - (1 / 4))]",
1678
+ "# [<>, <>]",
1679
+ "```",
1680
+ "N must be a count. The argument is bound as `.n <~~1>`, the count type read off",
1681
+ "a literal, so a non-count N is refused with a native `$!.type-error` before any",
1682
+ "fold or division: a fraction `1/2`, a float `2.5`, a negative `-1` and a string",
1683
+ "`“3”` are all not counts and all refused. A nonzero whole N divides the signed",
1684
+ "sum exactly, so `(5,2)` at N=3 is `1`",
1685
+ "```",
1686
+ "; (Figure [row2, row5]).spin 2.5",
1687
+ "# $!.type-error .n <~~1> 2.5",
1688
+ "; (Figure [row2, row5]).spin (1 / 2)",
1689
+ "# $!.type-error .n <~~1> 1/2",
1690
+ "; (Figure [row2, row5]).spin (0 - 1)",
1691
+ "# $!.type-error .n <~~1> -1",
1692
+ "; (Figure [row2, row5]).spin “3”",
1693
+ "# $!.type-error .n <~~1> “3”",
1694
+ "; (Figure [row5, row2]).spin 3",
1695
+ "# 1",
1696
+ "```",
1697
+ "A positive resolution is still required of a count N: `N=0` passes the count",
1698
+ "type and is then the native division-by-zero, and the empty argument `()` is not",
1699
+ "a count either but binds nothing, so it falls through to the same",
1700
+ "division-by-zero rather than a type error",
1701
+ "```",
1702
+ "; (Figure [row2, row5]).spin 0",
1703
+ "# $!.division-by-zero /",
1704
+ "; (Figure [row2, row5]).spin ()",
1705
+ "# $!.division-by-zero /",
1706
+ "```",
1614
1707
  "## The Fano plane",
1615
1708
  "",
1616
1709
  "Seven originals of identical form, each a fresh `Figure []`, and seven triples",
@@ -1 +1 @@
1
- export const VERSION = "0.31.0";
1
+ export const VERSION = "0.32.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hclang",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "description": "Homoiconic C command-line interpreter and REPL",
5
5
  "keywords": [
6
6
  "language",