hclang 0.49.0 → 0.51.0
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 +509 -538
- package/esm/lib/execute/denum-prologue.js +3 -15
- package/esm/lib/execute/router-prologue.js +14 -18
- package/esm/lib/frames/denum-observers.js +181 -0
- package/esm/lib/frames/fourth-hash.js +24 -12
- package/esm/lib/frames/frame-name.js +12 -20
- package/esm/lib/frames/frame.js +31 -2
- package/esm/lib/frames.js +2 -0
- package/esm/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -1672,15 +1672,14 @@ export const HC_SOURCES = new Map([
|
|
|
1672
1672
|
"the sum of its immediate child Sizes, and A alternates + and - across those",
|
|
1673
1673
|
"children, starting +. Properties do not enter these sums. D(X) = X.#### is",
|
|
1674
1674
|
"nil for the empty host; otherwise it has Count n, loads L = (S+A)/2, R = (S-A)/2",
|
|
1675
|
-
"and
|
|
1676
|
-
"
|
|
1677
|
-
"the phase is its parity. Nesting, identities, properties and the distribution",
|
|
1675
|
+
"and the next load is n %% 2. Read these with `.count` (or `.#`), `.loads .0`,",
|
|
1676
|
+
"`.loads .1` and `.# %% 2`. n is kept whole (007.25c). Nesting, identities, properties and the distribution",
|
|
1678
1677
|
"within each load are forgotten.",
|
|
1679
1678
|
"```",
|
|
1680
1679
|
"; .E []; .X [[], [[], []], []];",
|
|
1681
1680
|
"; [E.#, E.##, E.###, E.####]",
|
|
1682
1681
|
"# [0, 1, 0, ()]",
|
|
1683
|
-
"; [X.#, X.##, X.###, X
|
|
1682
|
+
"; [X.#, X.##, X.###, X.#### .# %% 2, X.#### .loads .0, X.#### .loads .1]",
|
|
1684
1683
|
"# [3, 4, 0, 1, 2, 2]",
|
|
1685
1684
|
"; .decorated [.label 99; [], [[], []], []];",
|
|
1686
1685
|
"; [decorated.#### = X.####, decorated.label, X.#### = X.####]",
|
|
@@ -1703,10 +1702,10 @@ export const HC_SOURCES = new Map([
|
|
|
1703
1702
|
"; [A = B, A.#### = B.####, A.#### === B.####]",
|
|
1704
1703
|
"# [(), <>, ()]",
|
|
1705
1704
|
"; .C [[[], []], [[], []]]; .F [[], [], [], []];",
|
|
1706
|
-
"; [C.#, F.#, C = F, C.#### = F.####, (C
|
|
1705
|
+
"; [C.#, F.#, C = F, C.#### = F.####, (C.#### .loads .0) = (F.#### .loads .0), (C.#### .loads .1) = (F.#### .loads .1), (C.#### .# %% 2) = (F.#### .# %% 2), A.#### = C.####]",
|
|
1707
1706
|
"# [2, 4, (), (), <>, <>, <>, ()]",
|
|
1708
1707
|
"; [“” A.####, “” C.####, “” F.####, “” [[], [[], []]].####]",
|
|
1709
|
-
"# [“Denum(1,1,0)”, “Denum(2,2,2)”, “Denum(4,2,2)”, “Denum(2,1,2)”]",
|
|
1708
|
+
"# [“Denum(1,[1, 0])”, “Denum(2,[2, 2])”, “Denum(4,[2, 2])”, “Denum(2,[1, 2])”]",
|
|
1710
1709
|
"```",
|
|
1711
1710
|
"Uniform append and Inlay, including successive compositions",
|
|
1712
1711
|
"",
|
|
@@ -1720,7 +1719,7 @@ export const HC_SOURCES = new Map([
|
|
|
1720
1719
|
"; [(A Y).#### = (A.#### Y), (C Y).#### = (C.#### Y), (X Y).#### = (X.#### Y)]",
|
|
1721
1720
|
"# [<>, <>, <>]",
|
|
1722
1721
|
"; [“” (A Y).####, “” (C Y).####, “” ((C Y) []).####]",
|
|
1723
|
-
"# [“Denum(2,1,3)”, “Denum(3,5,2)”, “Denum(4,5,3)”]",
|
|
1722
|
+
"# [“Denum(2,[1, 3])”, “Denum(3,[5, 2])”, “Denum(4,[5, 3])”]",
|
|
1724
1723
|
"; ([5, “ab”] []).#### = ([5, “ab”].#### [])",
|
|
1725
1724
|
"# <>",
|
|
1726
1725
|
"```",
|
|
@@ -1748,15 +1747,15 @@ export const HC_SOURCES = new Map([
|
|
|
1748
1747
|
"preconstruction state secretly stored in []. A zero Size deposit still adds one",
|
|
1749
1748
|
"to the Count and so changes routing phase.",
|
|
1750
1749
|
"```",
|
|
1751
|
-
"; [([] [])
|
|
1750
|
+
"; [([] []).#### .# %% 2, ([] []).#### .loads .0, ([] []).#### .loads .1]",
|
|
1752
1751
|
"# [1, 1, 0]",
|
|
1753
1752
|
"; [([] Y).#### = ([].#### Y), ([] * Y).#### = Y.####]",
|
|
1754
1753
|
"# [(), <>]",
|
|
1755
1754
|
"; Denums <- './hc/denum.hc';",
|
|
1756
|
-
"; ([] Y).#### = ((Denums.Denum [0, 0, 0]) Y)",
|
|
1755
|
+
"; ([] Y).#### = ((Denums.Denum [0, [0, 0]]) Y)",
|
|
1757
1756
|
"# <>",
|
|
1758
|
-
"; [“” [0].####, “” ([0].#### 0), [].#### = [0].####, [].#### = (Denums.Denum [0, 0, 0]), (Denums.Denum [0, 0, 0]).#### = (Denums.Denum [0, 0, 0])]",
|
|
1759
|
-
"# [“Denum(1,0,0)”, “Denum(2,0,0)”, (), (), <>]",
|
|
1757
|
+
"; [“” [0].####, “” ([0].#### 0), [].#### = [0].####, [].#### = (Denums.Denum [0, [0, 0]]), (Denums.Denum [0, [0, 0]]).#### = (Denums.Denum [0, [0, 0]])]",
|
|
1758
|
+
"# [“Denum(1,[0, 0])”, “Denum(2,[0, 0])”, (), (), <>]",
|
|
1760
1759
|
"```",
|
|
1761
1760
|
"For a proposed relabeling, exchange the loads AND toggle which named channel",
|
|
1762
1761
|
"is next: J(n,L,R) = (n+1,R,L). Toggling the phase changes the parity of the",
|
|
@@ -1770,13 +1769,13 @@ export const HC_SOURCES = new Map([
|
|
|
1770
1769
|
"following closure only checks that explicit relabeling using the existing Denum",
|
|
1771
1770
|
"class.",
|
|
1772
1771
|
"```",
|
|
1773
|
-
"; .swap {.d _; Denums.Denum [(d.count + 1), d.
|
|
1772
|
+
"; .swap {.d _; Denums.Denum [(d.count + 1), [d.loads .1, d.loads .0]]};",
|
|
1774
1773
|
"; .q [[], [[], []]].####;",
|
|
1775
1774
|
"; [“” q, “” (swap q), (swap q).## = q.##, (swap q).### = (0 - q.###)]",
|
|
1776
|
-
"# [“Denum(2,1,2)”, “Denum(3,2,1)”, <>, <>]",
|
|
1775
|
+
"# [“Denum(2,[1, 2])”, “Denum(3,[2, 1])”, <>, <>]",
|
|
1777
1776
|
"; [(swap (q Y)) = ((swap q) Y), (swap ((q Y) [])) = (((swap q) Y) []), (swap (q.scale_ 3)) = ((swap q).scale_ 3)]",
|
|
1778
1777
|
"# [<>, <>, <>]",
|
|
1779
|
-
"; [((swap (swap q))
|
|
1778
|
+
"; [((swap (swap q)).# %% 2) = (q.# %% 2), ((swap (swap q)).loads .0) = (q.loads .0), ((swap (swap q)).loads .1) = (q.loads .1), (swap (swap q)).count = (q.count + 2), (swap (swap q)) = q]",
|
|
1780
1779
|
"# [<>, <>, <>, <>, ()]",
|
|
1781
1780
|
"```",
|
|
1782
1781
|
"Future sufficiency, at its earned scope",
|
|
@@ -1935,12 +1934,13 @@ export const HC_SOURCES = new Map([
|
|
|
1935
1934
|
"```",
|
|
1936
1935
|
"Denum (occurrence/figure 011.20, 007.25c)",
|
|
1937
1936
|
"",
|
|
1938
|
-
"A Denum is a closed
|
|
1939
|
-
"Applying a Denum to a Frame deposits that Frame's Size into
|
|
1940
|
-
"
|
|
1941
|
-
"
|
|
1942
|
-
"
|
|
1943
|
-
"
|
|
1937
|
+
"A Denum is a closed state of k ordered channels, k ≥ 1: a Count and k loads.",
|
|
1938
|
+
"Applying a Denum to a Frame deposits that Frame's Size into load `C mod k` and",
|
|
1939
|
+
"adds one to the Count, so a Denum follows round-robin construction one",
|
|
1940
|
+
"observation at a time and remembers how many it has seen. Every arity is the",
|
|
1941
|
+
"same class, with the same fields, methods and text; two loads are not a special",
|
|
1942
|
+
"case. It is what the fourth hash answers: `x.####` is the Denum of x's Count,",
|
|
1943
|
+
"Size and residual, with Count x.# and the two loads (Size + residual)/2 and",
|
|
1944
1944
|
"(Size − residual)/2.",
|
|
1945
1945
|
"",
|
|
1946
1946
|
"`Denum` is an ordinary HC class: a constructor closure answering a fresh",
|
|
@@ -1950,45 +1950,29 @@ export const HC_SOURCES = new Map([
|
|
|
1950
1950
|
"in, the first time `.####` needs one. So this file is both the definition every",
|
|
1951
1951
|
"evaluator uses and its specification, and it works without a resource root.",
|
|
1952
1952
|
"Import it to construct Denums directly: `Denums <- './hc/denum.hc'`, then",
|
|
1953
|
-
"`Denums.Denum [0, 0, 0]`.",
|
|
1954
|
-
"",
|
|
1955
|
-
"**State (007.25c).**
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
"is the full application Count the state has recorded, not its parity, so",
|
|
1959
|
-
"`Denum [2, 5, 1]` and `Denum [4, 5, 1]` are different states
|
|
1960
|
-
"
|
|
1961
|
-
"
|
|
1962
|
-
"`Denum [
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
"
|
|
1966
|
-
"",
|
|
1967
|
-
"
|
|
1968
|
-
"
|
|
1969
|
-
"a
|
|
1970
|
-
"
|
|
1971
|
-
"
|
|
1972
|
-
"",
|
|
1973
|
-
"**State is Count and loads (007.40).** A Denum stores exactly two fields:",
|
|
1974
|
-
"`count`, the Count `C`, and `loads`, its ordered channel loads. Nothing else is",
|
|
1975
|
-
"stored, so nothing else can disagree with them. `d.count` and `d.#` are `C`,",
|
|
1976
|
-
"and `d.loads` is the list. Two Denums are `=` exactly when their Count and loads",
|
|
1977
|
-
"are. States with the same phase and loads but different Counts stay",
|
|
1978
|
-
"distinguishable.",
|
|
1979
|
-
"",
|
|
1980
|
-
"**Derived readings.** A binary Denum answers three readings computed from that",
|
|
1981
|
-
"state when applied to nil, as the ratios are: `d.phase ()`, `d.left ()` and",
|
|
1982
|
-
"`d.right ()`. `d.phase ()` reads the Count's parity and never the integer",
|
|
1983
|
-
"`C %% 2`: 2 when `C` is even, `C = 0` included, left next, and 1 when it is",
|
|
1984
|
-
"odd, right next. It is a Count rather than all or nil, so the odd phase is",
|
|
1985
|
-
"present. `d.left ()` and `d.right ()` are `d.loads .0` and `d.loads .1`. Any",
|
|
1986
|
-
"other operand is `$!!.unary-observation`. Before 007.40 these were stored fields",
|
|
1987
|
-
"written alongside the Count and loads; they are readings now, so application",
|
|
1988
|
-
"routes by the Count's parity and no write can make them diverge.",
|
|
1953
|
+
"`Denums.Denum [0, [0, 0]]`.",
|
|
1954
|
+
"",
|
|
1955
|
+
"**State (007.25c, 007.40).** A Denum stores exactly two fields: `count`, the",
|
|
1956
|
+
"Count `C`, and `loads`, its ordered loads. Nothing else is stored, so nothing",
|
|
1957
|
+
"can disagree with them. `d.count` and `d.#` are `C`, and `d.loads` is the list.",
|
|
1958
|
+
"`C` is the full application Count the state has recorded, not its parity, so",
|
|
1959
|
+
"`Denum [2, [5, 1]]` and `Denum [4, [5, 1]]` are different states with the same",
|
|
1960
|
+
"loads. Two Denums are `=` exactly when their Count and loads are.",
|
|
1961
|
+
"",
|
|
1962
|
+
"**Constructor forms.** `Denum [C, loads]` takes a Count and a nonempty list of",
|
|
1963
|
+
"Counts, any of them zero. `Denum [loads]`, a single list, is the default-Count",
|
|
1964
|
+
"form with `C = 1` (007.40): `Denum [[2, 5]]` is `Denum [1, [2, 5]]`. It is a",
|
|
1965
|
+
"constructor convention, not a claim that the state was reached by one",
|
|
1966
|
+
"application, and an explicit Count always wins, so `Denum [0, [2, 5]]` keeps",
|
|
1967
|
+
"Count zero. There is no other form: the three-argument `Denum [C, L, R]` of",
|
|
1968
|
+
"earlier versions is refused too. Anything else is refused with",
|
|
1969
|
+
"`$!!.invalid-denum`, a named error, as Figures refuses an unsupported host. A host declaration such as",
|
|
1970
|
+
"`(.# C;)` is not a constructor option. `Denum [0, [0]]` is the neutral start of",
|
|
1971
|
+
"arity one, `Denum [0, [0, 0]]` of arity two.",
|
|
1989
1972
|
"",
|
|
1990
1973
|
"**Observers.** A Denum declares its own Count, Size and residual (011.20): its",
|
|
1991
|
-
"Count `C`,
|
|
1974
|
+
"Count `C`, the sum of its loads and their alternating sum `e0 − e1 + e2 − …`,",
|
|
1975
|
+
"the list residual, which for two loads is `L − R`. An aggregate",
|
|
1992
1976
|
"otherwise observes its elements, and a Denum has none, so without these it",
|
|
1993
1977
|
"would observe as 0, 1, 0. Its fourth hash is not declared: no class can",
|
|
1994
1978
|
"declare `.####`. The derivation from the three observers cannot tell an empty",
|
|
@@ -2003,14 +1987,13 @@ export const HC_SOURCES = new Map([
|
|
|
2003
1987
|
"`0.####` stay nil: those are hosts with no children, and a host with no",
|
|
2004
1988
|
"children has no Denum.",
|
|
2005
1989
|
"",
|
|
2006
|
-
"**Application**, `d x`: observe x's Size once, deposit it into
|
|
2007
|
-
"
|
|
2008
|
-
"which flips the phase. A Size of zero still counts. If x has no Size, its",
|
|
1990
|
+
"**Application**, `d x`: observe x's Size once, deposit it into load",
|
|
1991
|
+
"`C mod k` and add one to the Count. A Size of zero still counts. If x has no Size, its",
|
|
2009
1992
|
"failure is the answer rather than a deposit. It is a mutating method, `apply_`,",
|
|
2010
1993
|
"so through a name, `d x` is a functional update: it answers a new Denum and",
|
|
2011
1994
|
"leaves d unchanged.",
|
|
2012
1995
|
"",
|
|
2013
|
-
"**Scaling**, `d.scale_ k`: multiply
|
|
1996
|
+
"**Scaling**, `d.scale_ k`: multiply every load by a Count k, keeping the",
|
|
2014
1997
|
"Count. It is the numerical shadow of Star: `(x * y).####` is",
|
|
2015
1998
|
"`x.####.scale_ (y.##)` for a nonempty host x, Count included. `scale_` stays,",
|
|
2016
1999
|
"as the name the fourth hash and Star correspondence use; `d * k` answers the",
|
|
@@ -2023,37 +2006,42 @@ export const HC_SOURCES = new Map([
|
|
|
2023
2006
|
"is running. All three **construct a fresh Denum state** from the one Size",
|
|
2024
2007
|
"observation `x.##` of their operand, keeping Figure 008's distinction between",
|
|
2025
2008
|
"construction and observation. They are **fixed-channel load transformations**",
|
|
2026
|
-
"on the
|
|
2009
|
+
"on the loads, consistent with the channel loads of a `RotorRouter`",
|
|
2027
2010
|
"(`hc/rotor-router.hc`): `+` and `-` add `x.##` to one fixed channel's load the",
|
|
2028
2011
|
"way a route adds a Frame's Size to the channel it lands in, and `*` is the Star",
|
|
2029
2012
|
"shadow `scale_`. These are correspondences, not a claim that the Router",
|
|
2030
2013
|
"declares named `+`, `-` or `*` methods. None of the three is application: **all",
|
|
2031
|
-
"keep `C
|
|
2014
|
+
"keep `C`**, and each answers a fresh value and leaves `d` as it",
|
|
2032
2015
|
"was. Because they change loads without an application, they can reach a state",
|
|
2033
2016
|
"no run of applications reaches, such as `C = 0` with a nonzero load.",
|
|
2034
2017
|
"",
|
|
2035
|
-
"- `d + x` is the **tally** operator: it deposits `x.##` on the
|
|
2036
|
-
"
|
|
2037
|
-
" application. It is `d.
|
|
2038
|
-
"
|
|
2039
|
-
"
|
|
2040
|
-
"
|
|
2041
|
-
"
|
|
2042
|
-
"
|
|
2043
|
-
"-
|
|
2044
|
-
"
|
|
2018
|
+
"- `d + x` is the **tally** operator: it deposits `x.##` on load 1, the first",
|
|
2019
|
+
" load the residual subtracts. A sizeless host's failure is the answer, as it is",
|
|
2020
|
+
" for application. It is `d.deposit_ [1, x.##]`, a load-only functional",
|
|
2021
|
+
" update. With one load there is no load 1, and `+` is `$!!.invalid-arity`.",
|
|
2022
|
+
"- `d - x` is the **alternator** operator: it deposits on load 0, the first load",
|
|
2023
|
+
" the residual adds, as `d.deposit_ [0, x.##]`. It is not subtraction: a",
|
|
2024
|
+
" deposit only ever adds, so a load never goes negative and stays a whole Count.",
|
|
2025
|
+
" `+` lowers the residual and `-` raises it, the reverse of ordinary",
|
|
2026
|
+
" signed-scalar `+` and `-`.",
|
|
2027
|
+
"- `d * x` is the **inlay** operator: it scales every load by the operand's Size",
|
|
2028
|
+
" `x.##`, keeping `C`. It reads the operand",
|
|
2045
2029
|
" through the one Size observer, as `+` and `-` do, so any sized Frame scales a",
|
|
2046
2030
|
" Denum, not only a bare Count. It is literally `d.scale_ (x.##)`.",
|
|
2047
2031
|
"",
|
|
2048
2032
|
"None of the three names the `Denum` constructor inside its method. A bare name",
|
|
2049
2033
|
"in a method is looked up on the argument first (spec 7), and a decimal is",
|
|
2050
2034
|
"unit-taggable, so inside `d + 2.5` the name `Denum` read `2.5.Denum`, a tagged",
|
|
2051
|
-
"number, and applying that to `[C,
|
|
2035
|
+
"number, and applying that to `[C, loads]` was `$!.repetition-domain` (007.25e,",
|
|
2052
2036
|
"PR #480 review). Each operator now hands the one Size it observed to a",
|
|
2053
|
-
"load-only functional update on the receiver, `
|
|
2054
|
-
"
|
|
2055
|
-
"
|
|
2056
|
-
"
|
|
2037
|
+
"load-only functional update on the receiver, `deposit_` or `scale_`, so",
|
|
2038
|
+
"`D + 2.5`, `D - 2.5` and `D * 2.5` all read `(2.5).## = 2`.",
|
|
2039
|
+
"",
|
|
2040
|
+
"**Deposit**, `d.deposit_ [i, k]`: add the Count k to load i and keep the Count,",
|
|
2041
|
+
"a load-only functional update for any index of any arity. A k that is not a",
|
|
2042
|
+
"Count, or an argument that is not a pair, is `$!!.invalid-denum`, since a",
|
|
2043
|
+
"negative deposit is no Denum; an index that is not a load of this Denum is",
|
|
2044
|
+
"`$!!.invalid-arity`.",
|
|
2057
2045
|
"",
|
|
2058
2046
|
"**Rational readings (007.25).** Because `C` is kept, two exact ratios are read",
|
|
2059
2047
|
"from the state. They are unary observations of the stored state, not `/` and",
|
|
@@ -2062,8 +2050,8 @@ export const HC_SOURCES = new Map([
|
|
|
2062
2050
|
"`$!!.unary-observation`, so `d.size-ratio 4` is refused rather than read as a",
|
|
2063
2051
|
"division by 4.",
|
|
2064
2052
|
"",
|
|
2065
|
-
"- `d.size-ratio ()` is `S / C` for `S =
|
|
2066
|
-
"- `d.residual-ratio ()` is `Δ / C` for `Δ =
|
|
2053
|
+
"- `d.size-ratio ()` is `S / C` for `S = d.##`, exact and nonnegative.",
|
|
2054
|
+
"- `d.residual-ratio ()` is `Δ / C` for `Δ = d.###`, exact and signed.",
|
|
2067
2055
|
"",
|
|
2068
2056
|
"Both are **nil when `C = 0`**, whatever the loads: the state exists and its Size",
|
|
2069
2057
|
"and residual still read, but the ratio is absent, so there is no `0/0`, infinity",
|
|
@@ -2078,23 +2066,7 @@ export const HC_SOURCES = new Map([
|
|
|
2078
2066
|
"rational geometry.",
|
|
2079
2067
|
"",
|
|
2080
2068
|
"**Text.** A Denum prints as what it is, an aggregate of fields and methods. As",
|
|
2081
|
-
"text it reads `Denum(C,
|
|
2082
|
-
"",
|
|
2083
|
-
"**Channels and division (007.27).** The two loads are the arity-two case of an",
|
|
2084
|
-
"ordered list of channel loads. `Denum [C, loads]` takes a Count and a nonempty",
|
|
2085
|
-
"list of Counts: two loads are this binary Denum, the same instance",
|
|
2086
|
-
"`Denum [C, L, R]` builds, and any other number is a channel Denum. Every Denum",
|
|
2087
|
-
"stores `count` and `loads` and nothing else; only the binary one also answers",
|
|
2088
|
-
"the readings `phase ()`, `left ()` and `right ()`. A channel Denum of arity k",
|
|
2089
|
-
"deposits into channel `C mod k`, which for k = 2 is the phase's channel. Its",
|
|
2090
|
-
"Size is the sum of its loads and its residual their alternating sum",
|
|
2091
|
-
"`e0 − e1 + e2 − …`, the list residual, which for two loads is `L − R`. Its",
|
|
2092
|
-
"fourth hash is intrinsic too: a fresh equal Denum of the same arity. Its `*`,",
|
|
2093
|
-
"`scale_` and ratios are as here. Its `+` and `-` follow the residual's signs:",
|
|
2094
|
-
"`-` deposits on the first even load, load 0, raising the residual, and `+` on",
|
|
2095
|
-
"the first odd load, load 1, lowering it, which for two loads are left and",
|
|
2096
|
-
"right; with one load `+` is `$!!.invalid-arity`. Text reads `Denum(C,[e0, e1,",
|
|
2097
|
-
"…])`.",
|
|
2069
|
+
"text it reads `Denum(C,[e0, e1, …])`, the Count and its loads, for every arity.",
|
|
2098
2070
|
"",
|
|
2099
2071
|
"`d ./ n`, also spelled `d / n`, redistributes the Size: it keeps C and the",
|
|
2100
2072
|
"total S and deals S Size units round-robin into n channels, so the first",
|
|
@@ -2108,73 +2080,40 @@ export const HC_SOURCES = new Map([
|
|
|
2108
2080
|
"",
|
|
2109
2081
|
"**Methods read their own state through `_^`.** A bare name inside a method is",
|
|
2110
2082
|
"looked up on the argument first (spec 7), and a Denum is applied to arbitrary",
|
|
2111
|
-
"Frames, so a bare `
|
|
2083
|
+
"Frames, so a bare `loads` could read the argument's field. `_^` is the receiver",
|
|
2112
2084
|
"from a method's body, and `_^^` from a block one level in, because carets",
|
|
2113
2085
|
"count lexically (spec a06). What a branch needs is bound as a local at method",
|
|
2114
|
-
"level, where nested blocks read it
|
|
2115
|
-
"
|
|
2116
|
-
"
|
|
2086
|
+
"level, where nested blocks read it; a deposit builds its own small cursor",
|
|
2087
|
+
"there, which adds a Size at one load index when the loads are reduced through",
|
|
2088
|
+
"it, so a Denum printed and read back still applies. The file's own names, the",
|
|
2089
|
+
"constructor `Denum` and the helper `redistribution` (the round-robin loads of S",
|
|
2117
2090
|
"units in n channels), are read the same way, through the scope a caret ladder",
|
|
2118
2091
|
"reaches, `(_^^^ .Denum)` from a branch, so an argument's fields never stand in",
|
|
2119
2092
|
"for them.",
|
|
2120
2093
|
"```",
|
|
2121
|
-
".deposit-at {.at (_ .0); .by (_ .1); [.index 0; .target at; .amount by; .out [];",
|
|
2122
|
-
" .apply_ {.v _; .i (_^ .index); .t (_^ .target); .a (_^ .amount); .o (_^ .out);",
|
|
2123
|
-
" @out (o ((i = t) ? {v + a} : {v})); @index (i + 1);}]};",
|
|
2124
2094
|
".redistribution {.s (_ .0); .ways (_ .1); .r (s %% ways); .q (((s - r) / ways).##);",
|
|
2125
2095
|
" ((ways - r) [q]) | (r [(q + 1)])};",
|
|
2126
|
-
".
|
|
2127
|
-
" .count c;",
|
|
2128
|
-
" .loads [l, r];",
|
|
2129
|
-
" .# {_^.count};",
|
|
2130
|
-
" .## {(_^ .loads).##};",
|
|
2131
|
-
" .### {(_^ .loads).###};",
|
|
2132
|
-
" .phase {.c (_^ .count); .u ((_ = ()) ? {1} : {0});",
|
|
2133
|
-
" (u = 1) ? {((c %% 2) = 0) ? {2} : {1}} : {$!!.unary-observation}};",
|
|
2134
|
-
" .left {.e (_^ .loads); .u ((_ = ()) ? {1} : {0});",
|
|
2135
|
-
" (u = 1) ? {e .0} : {$!!.unary-observation}};",
|
|
2136
|
-
" .right {.e (_^ .loads); .u ((_ = ()) ? {1} : {0});",
|
|
2137
|
-
" (u = 1) ? {e .1} : {$!!.unary-observation}};",
|
|
2138
|
-
" .apply_ {.s (_ .##); .c (_^ .count); .e (_^ .loads); .l (e .0); .r (e .1);",
|
|
2139
|
-
" (s ~ (0.<>)) ? {((c %% 2) = 0) ? {@loads [(l + s), r];} : {@loads [l, (r + s)];}; @count (c + 1); _^^} : {s}};",
|
|
2140
|
-
" .scale_ {.k _; .e (_^ .loads); .l (e .0); .r (e .1);",
|
|
2141
|
-
" (k ~ (0.<>)) ? {@loads [(l * k), (r * k)]; _^^} : {$!!.invalid-scale}};",
|
|
2142
|
-
" .deposit-right_ {.k _; .e (_^ .loads); .l (e .0); .r (e .1);",
|
|
2143
|
-
" (k ~ (0.<>)) ? {@loads [l, (r + k)]; _^^} : {$!!.invalid-denum}};",
|
|
2144
|
-
" .deposit-left_ {.k _; .e (_^ .loads); .l (e .0); .r (e .1);",
|
|
2145
|
-
" (k ~ (0.<>)) ? {@loads [(l + k), r]; _^^} : {$!!.invalid-denum}};",
|
|
2146
|
-
" .+ {.s (_ .##);",
|
|
2147
|
-
" (s ~ (0.<>)) ? {(_^^ .deposit-right_ s)} : {s}};",
|
|
2148
|
-
" .- {.s (_ .##);",
|
|
2149
|
-
" (s ~ (0.<>)) ? {(_^^ .deposit-left_ s)} : {s}};",
|
|
2150
|
-
" .* {.s (_ .##);",
|
|
2151
|
-
" (s ~ (0.<>)) ? {(_^^ .scale_ s)} : {s}};",
|
|
2152
|
-
" ./ {.ways _; .c (_^ .count); .s (_^ .##); .v ([] / ways);",
|
|
2153
|
-
" (v ~ ([].<>)) ? {(_^^^ .Denum) [c, ((_^^^ .redistribution) [s, ways])]} : {v}};",
|
|
2154
|
-
" .size-ratio {.c (_^ .count); .s (_^ .##); .u ((_ = ()) ? {1} : {0});",
|
|
2155
|
-
" (c .> 0) ? {(u = 1) ? {s / c} : {$!!.unary-observation}}};",
|
|
2156
|
-
" .residual-ratio {.c (_^ .count); .d (_^ .###); .u ((_ = ()) ? {1} : {0});",
|
|
2157
|
-
" (c .> 0) ? {(u = 1) ? {d / c} : {$!!.unary-observation}}};",
|
|
2158
|
-
" .toText {.e (_^ .loads); “Denum(” (_^ .count) “,” (e .0) “,” (e .1) “)”}",
|
|
2159
|
-
" ]};",
|
|
2160
|
-
".channel-denum {.c (_ .0); .e (_ .1); [",
|
|
2096
|
+
".denum-instance {.c (_ .0); .e (_ .1); [",
|
|
2161
2097
|
" .count c;",
|
|
2162
2098
|
" .loads e;",
|
|
2163
2099
|
" .# {_^.count};",
|
|
2164
2100
|
" .## {(_^ .loads).##};",
|
|
2165
2101
|
" .### {(_^ .loads).###};",
|
|
2166
2102
|
" .apply_ {.s (_ .##); .c (_^ .count); .e (_^ .loads);",
|
|
2167
|
-
" (
|
|
2103
|
+
" .at (c %% (e.#)); .cursor [.index 0; .target at; .amount s; .out []; .apply_ {.v _; .i (_^ .index); .t (_^ .target); .a (_^ .amount); .o (_^ .out); @out (o ((i = t) ? {v + a} : {v})); @index (i + 1);}];",
|
|
2104
|
+
" (s ~ (0.<>)) ? {@loads ((e | cursor) .out); @count (c + 1); _^^} : {s}};",
|
|
2168
2105
|
" .scale_ {.k _; .e (_^ .loads);",
|
|
2169
2106
|
" (k ~ (0.<>)) ? {@loads (e & {_ * k}); _^^} : {$!!.invalid-scale}};",
|
|
2170
|
-
" .
|
|
2171
|
-
" ((
|
|
2172
|
-
"
|
|
2173
|
-
" (
|
|
2107
|
+
" .deposit_ {.a _; .e (_^ .loads);",
|
|
2108
|
+
" .ok (((a ~ ([].<>)) ? {((a.#) = 2) ? {(a .1) ~ (0.<>)}}) ? {1} : {0});",
|
|
2109
|
+
" .at ((ok = 1) ? {a .0} : {0}); .k ((ok = 1) ? {a .1} : {0});",
|
|
2110
|
+
" .ix (((ok = 1) ? {(at ~ (0.<>)) ? {(e.#) .> at}}) ? {1} : {0});",
|
|
2111
|
+
" .cursor [.index 0; .target at; .amount k; .out []; .apply_ {.v _; .i (_^ .index); .t (_^ .target); .a (_^ .amount); .o (_^ .out); @out (o ((i = t) ? {v + a} : {v})); @index (i + 1);}];",
|
|
2112
|
+
" (ix = 1) ? {@loads ((e | cursor) .out); _^^} : {(ok = 1) ? {$!!.invalid-arity} : {$!!.invalid-denum}}};",
|
|
2174
2113
|
" .+ {.s (_ .##);",
|
|
2175
|
-
" (s ~ (0.<>)) ? {(_^^ .
|
|
2114
|
+
" (s ~ (0.<>)) ? {(_^^ .deposit_ [1, s])} : {s}};",
|
|
2176
2115
|
" .- {.s (_ .##);",
|
|
2177
|
-
" (s ~ (0.<>)) ? {(_^^ .
|
|
2116
|
+
" (s ~ (0.<>)) ? {(_^^ .deposit_ [0, s])} : {s}};",
|
|
2178
2117
|
" .* {.s (_ .##);",
|
|
2179
2118
|
" (s ~ (0.<>)) ? {(_^^ .scale_ s)} : {s}};",
|
|
2180
2119
|
" ./ {.ways _; .c (_^ .count); .s (_^ .##); .v ([] / ways);",
|
|
@@ -2185,55 +2124,57 @@ export const HC_SOURCES = new Map([
|
|
|
2185
2124
|
" (c .> 0) ? {(u = 1) ? {d / c} : {$!!.unary-observation}}};",
|
|
2186
2125
|
" .toText {“Denum(” (_^ .count) “,” (_^ .loads) “)”}",
|
|
2187
2126
|
" ]};",
|
|
2188
|
-
".Denum {((_ ~ ([].<>)) ? {(__ .#) ~ <1, 2
|
|
2127
|
+
".Denum {((_ ~ ([].<>)) ? {(__ .#) ~ <1, 2>}) ? {.a __; .n (a.#);",
|
|
2189
2128
|
" .c ((n = 1) ? {1} : {a .0});",
|
|
2190
|
-
" .boxed ((n =
|
|
2129
|
+
" .boxed ((n = 2) ? {[a .1]} : {[a .0]});",
|
|
2191
2130
|
" ((c ~ (0.<>)) ? {(boxed .0) ~ ([].<>)}) ? {.e (boxed .0); .k (e.#);",
|
|
2192
2131
|
" ((k .> 0) ? {(e &| {.x _; (x ~ (0.<>)) ? {[]} : {[x]}}).# = 0}) ? {",
|
|
2193
|
-
"
|
|
2132
|
+
" denum-instance [c, (e | [])]",
|
|
2194
2133
|
" } : {$!!.invalid-denum}} : {$!!.invalid-denum}} : {$!!.invalid-denum}};",
|
|
2195
2134
|
"```",
|
|
2196
2135
|
"## Construction",
|
|
2197
2136
|
"",
|
|
2198
|
-
"A Denum holds its Count and its
|
|
2199
|
-
"
|
|
2200
|
-
"
|
|
2137
|
+
"A Denum holds its Count and its loads. Each instance is its own: two built",
|
|
2138
|
+
"from the same constructor share nothing. The neutral start `Denum [0, [0, 0]]`",
|
|
2139
|
+
"is present, with Count zero",
|
|
2201
2140
|
"```",
|
|
2202
|
-
"; .d (Denum [0, 0, 0]);",
|
|
2203
|
-
"; [d.count, d
|
|
2204
|
-
"# [0,
|
|
2205
|
-
"; .a (Denum [2, 5, 3]); .b (Denum [1, 7, 0]);",
|
|
2206
|
-
"; [“” a, “” b, a.
|
|
2207
|
-
"# [“Denum(2,5,3)”, “Denum(1,7,0)”, 5, 7,
|
|
2141
|
+
"; .d (Denum [0, [0, 0]]);",
|
|
2142
|
+
"; [d.count, d.# %% 2, d.loads .0, d.loads .1, d.loads, d.#, d.##, d.###, “” d]",
|
|
2143
|
+
"# [0, 0, 0, 0, [0, 0], 0, 0, 0, “Denum(0,[0, 0])”]",
|
|
2144
|
+
"; .a (Denum [2, [5, 3]]); .b (Denum [1, [7, 0]]);",
|
|
2145
|
+
"; [“” a, “” b, a.loads .0, b.loads .0, a.# %% 2, b.# %% 2]",
|
|
2146
|
+
"# [“Denum(2,[5, 3])”, “Denum(1,[7, 0])”, 5, 7, 0, 1]",
|
|
2208
2147
|
"```",
|
|
2209
|
-
"Any Counts are a state.
|
|
2210
|
-
"
|
|
2148
|
+
"Any Counts are a state. With two loads the next load is the Count's parity,",
|
|
2149
|
+
"`C %% 2`: 0 when even, zero included, and 1 when odd",
|
|
2211
2150
|
"```",
|
|
2212
|
-
"; [0, 1, 2, 3, 4, 5, 100, 101] & {(Denum [_, 5, 3])
|
|
2213
|
-
"# [
|
|
2214
|
-
"; [(Denum [2, 5, 3]).#, (Denum [4, 5, 3]).#, (Denum [100, 5, 3]).count, (Denum [100, 5, 3])
|
|
2215
|
-
"# [2, 4, 100,
|
|
2151
|
+
"; [0, 1, 2, 3, 4, 5, 100, 101] & {(Denum [_, [5, 3]]).# %% 2}",
|
|
2152
|
+
"# [0, 1, 0, 1, 0, 1, 0, 1]",
|
|
2153
|
+
"; [(Denum [2, [5, 3]]).#, (Denum [4, [5, 3]]).#, (Denum [100, [5, 3]]).count, (Denum [100, [5, 3]]).# %% 2, (Denum [3, [5, 3]]).# %% 2]",
|
|
2154
|
+
"# [2, 4, 100, 0, 1]",
|
|
2216
2155
|
"```",
|
|
2217
2156
|
"A positive Count over empty loads and nonzero loads over a zero Count are both",
|
|
2218
2157
|
"states. Anything that is not three Counts is refused",
|
|
2219
2158
|
"```",
|
|
2220
|
-
"; [“” (Denum [3, 0, 0]), “” (Denum [0, 3, 0]), “” (Denum [0, 0, 4])]",
|
|
2221
|
-
"# [“Denum(3,0,0)”, “Denum(0,3,0)”, “Denum(0,0,4)”]",
|
|
2222
|
-
"; [Denum [2, (0 - 1), 0], Denum [(0 - 1), 1, 1], Denum [(5 - 3), (5 - 7), 0], Denum [2, 1], Denum 5, Denum [2, 1.5, 0], Denum [2, 1, 0, 0]]",
|
|
2159
|
+
"; [“” (Denum [3, [0, 0]]), “” (Denum [0, [3, 0]]), “” (Denum [0, [0, 4]])]",
|
|
2160
|
+
"# [“Denum(3,[0, 0])”, “Denum(0,[3, 0])”, “Denum(0,[0, 4])”]",
|
|
2161
|
+
"; [Denum [2, [(0 - 1), 0]], Denum [(0 - 1), [1, 1]], Denum [(5 - 3), [(5 - 7), 0]], Denum [2, 1], Denum 5, Denum [2, [1.5, 0]], Denum [2, 1, 0, 0]]",
|
|
2223
2162
|
"# [$!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum]",
|
|
2224
2163
|
"```",
|
|
2225
2164
|
"## Constructor forms",
|
|
2226
2165
|
"",
|
|
2227
2166
|
"`Denum [loads]` is the default-Count form: the Count is 1. It is a constructor",
|
|
2228
|
-
"convention. An explicit Count, zero included, is kept as given. `[C, loads]`
|
|
2229
|
-
"the
|
|
2230
|
-
"
|
|
2167
|
+
"convention. An explicit Count, zero included, is kept as given. `[C, loads]` is",
|
|
2168
|
+
"the explicit form, and any arity of one or more loads is a Denum. The",
|
|
2169
|
+
"three-argument form of earlier versions is refused",
|
|
2231
2170
|
"```",
|
|
2232
2171
|
"; [“” (Denum [[2, 5]]), “” (Denum [0, [2, 5]]), “” (Denum [[7]]), “” (Denum [[2, 5, 3]])]",
|
|
2233
|
-
"# [“Denum(1,2,5)”, “Denum(0,2,5)”, “Denum(1,[7])”, “Denum(1,[2, 5, 3])”]",
|
|
2234
|
-
"; [
|
|
2235
|
-
"# [
|
|
2236
|
-
"; [(Denum [
|
|
2172
|
+
"# [“Denum(1,[2, 5])”, “Denum(0,[2, 5])”, “Denum(1,[7])”, “Denum(1,[2, 5, 3])”]",
|
|
2173
|
+
"; [Denum [2, 5, 3], Denum [0, 0, 0], Denum [3, 12, 3]]",
|
|
2174
|
+
"# [$!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum]",
|
|
2175
|
+
"; [“” (Denum [3, [2, 5, 3, 7, 4]]), “” (Denum [0, [1]]), “” (Denum [2, [2, 5]]), “” (Denum [3, [4]])]",
|
|
2176
|
+
"# [“Denum(3,[2, 5, 3, 7, 4])”, “Denum(0,[1])”, “Denum(2,[2, 5])”, “Denum(3,[4])”]",
|
|
2177
|
+
"; [(Denum [[2, 5]]).#, (Denum [[2, 5]]).##, (Denum [[2, 5]]) = (Denum [1, [2, 5]]), (Denum [[2, 5]]) = (Denum [1, [2, 5]])]",
|
|
2237
2178
|
"# [1, 7, <>, <>]",
|
|
2238
2179
|
"; (Denum [[123456789012345678901234567890, 5, 3]]).##",
|
|
2239
2180
|
"# 123456789012345678901234567898",
|
|
@@ -2246,99 +2187,94 @@ export const HC_SOURCES = new Map([
|
|
|
2246
2187
|
"; [Denum [1.5, [2, 5]], Denum [(0 - 1), [2, 5]], Denum [“a”, [2, 5]], Denum [2, [2, (0 - 1)]], Denum [2, []], Denum [2, 5], Denum [2, 1, 2, 3]]",
|
|
2247
2188
|
"# [$!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum]",
|
|
2248
2189
|
"```",
|
|
2249
|
-
"
|
|
2250
|
-
"
|
|
2251
|
-
"
|
|
2190
|
+
"Routing follows the Count alone: application deposits into load",
|
|
2191
|
+
"`C mod arity`, here `C mod 2`, so two Denums with the same loads and Counts of",
|
|
2192
|
+
"different parity route to different loads",
|
|
2252
2193
|
"```",
|
|
2253
|
-
"; [(Denum [2, 0, 0]) 5, (Denum [3, 0, 0]) 5] & {“” _}",
|
|
2254
|
-
"# [“Denum(3,5,0)”, “Denum(4,0,5)”]",
|
|
2194
|
+
"; [(Denum [2, [0, 0]]) 5, (Denum [3, [0, 0]]) 5] & {“” _}",
|
|
2195
|
+
"# [“Denum(3,[5, 0])”, “Denum(4,[0, 5])”]",
|
|
2255
2196
|
"```",
|
|
2256
|
-
"A Denum stores its Count and loads and nothing else,
|
|
2257
|
-
"
|
|
2258
|
-
"
|
|
2259
|
-
"the stored loads, the Size is their sum, and the fourth hash is the state",
|
|
2260
|
-
"itself. The readings are applied to nil; any other operand is refused",
|
|
2197
|
+
"A Denum stores its Count and loads and nothing else, whatever its arity. Along",
|
|
2198
|
+
"any run of applications, deposits and scalings its Size is the sum of its loads",
|
|
2199
|
+
"and its fourth hash is the state itself",
|
|
2261
2200
|
"```",
|
|
2262
2201
|
"; .walk {.s _; [s, (s 5), ((s 5) - 2), (((s 5) - 2) + 3), ((((s 5) - 2) + 3) * 2), (((((s 5) - 2) + 3) * 2) 0)]};",
|
|
2263
|
-
"; .agree {.k _;
|
|
2264
|
-
"; [(walk (Denum [0, 0, 0])) & agree, (walk (Denum [1, 4, 1])) & agree]",
|
|
2265
|
-
"# [[<>, <>, <>, <>, <>, <>], [<>, <>, <>, <>, <>, <>]]",
|
|
2266
|
-
"; [(Denum [3, 5, 1]).phase 0, (Denum [3, 5, 1]).left [], (Denum [3, 5, 1]).right “a”]",
|
|
2267
|
-
"# [$!!.unary-observation, $!!.unary-observation, $!!.unary-observation]",
|
|
2202
|
+
"; .agree {.k _; (k.## = (k.loads).##) ? {k.#### = k}};",
|
|
2203
|
+
"; [(walk (Denum [0, [0, 0]])) & agree, (walk (Denum [1, [4, 1]])) & agree, (walk (Denum [2, [1, 2, 3]])) & agree]",
|
|
2204
|
+
"# [[<>, <>, <>, <>, <>, <>], [<>, <>, <>, <>, <>, <>], [<>, <>, <>, <>, <>, <>]]",
|
|
2268
2205
|
"```",
|
|
2269
2206
|
"## Application",
|
|
2270
2207
|
"",
|
|
2271
|
-
"Each application deposits the argument's Size into
|
|
2272
|
-
"
|
|
2273
|
-
"as it was",
|
|
2208
|
+
"Each application deposits the argument's Size into load `C mod k` and adds one",
|
|
2209
|
+
"to the Count. The receiver is left as it was",
|
|
2274
2210
|
"```",
|
|
2275
2211
|
"; “” (d [5, 3])",
|
|
2276
|
-
"# “Denum(1,8,0)”",
|
|
2212
|
+
"# “Denum(1,[8, 0])”",
|
|
2277
2213
|
"; “” d",
|
|
2278
|
-
"# “Denum(0,0,0)”",
|
|
2214
|
+
"# “Denum(0,[0, 0])”",
|
|
2279
2215
|
"; “” (((d 5) 3) 7)",
|
|
2280
|
-
"# “Denum(3,12,3)”",
|
|
2216
|
+
"# “Denum(3,[12, 3])”",
|
|
2281
2217
|
"```",
|
|
2282
|
-
"A Size of zero deposits nothing and still counts, in both
|
|
2218
|
+
"A Size of zero deposits nothing and still counts, in both parities",
|
|
2283
2219
|
"```",
|
|
2284
|
-
"; [(d 0).count, ((d 0) 0).count, (d 0)
|
|
2285
|
-
"# [1, 2, 1,
|
|
2220
|
+
"; [(d 0).count, ((d 0) 0).count, (d 0).# %% 2, ((d 0) 0).# %% 2, (d 0).loads .0, ((d 0) 0).loads .1]",
|
|
2221
|
+
"# [1, 2, 1, 0, 0, 0]",
|
|
2286
2222
|
"```",
|
|
2287
2223
|
"Any Frame is applied by its Size, measured without running it: text, the",
|
|
2288
2224
|
"empty aggregate and all (Size 1 each), nested aggregates, a closure (one per",
|
|
2289
2225
|
"word, so `{5 + 3}` is 9), empty text, and loads too large for a machine integer",
|
|
2290
2226
|
"```",
|
|
2291
2227
|
"; “” ((((((d “hello”) []) <>) [[1, 2], [3]]) {5 + 3}) “”)",
|
|
2292
|
-
"# “Denum(6,15,7)”",
|
|
2228
|
+
"# “Denum(6,[15, 7])”",
|
|
2293
2229
|
"; “” ((d 123456789012345678901234567890) 987654321098765432109876543210)",
|
|
2294
|
-
"# “Denum(2,123456789012345678901234567890,987654321098765432109876543210)”",
|
|
2230
|
+
"# “Denum(2,[123456789012345678901234567890, 987654321098765432109876543210])”",
|
|
2295
2231
|
"```",
|
|
2296
2232
|
"A Frame without a Size is not deposited: its failure is the answer",
|
|
2297
2233
|
"```",
|
|
2298
2234
|
"; d ([].nope)",
|
|
2299
2235
|
"# $!.name-missing “...",
|
|
2300
2236
|
"; “” d",
|
|
2301
|
-
"# “Denum(0,0,0)”",
|
|
2237
|
+
"# “Denum(0,[0, 0])”",
|
|
2302
2238
|
"```",
|
|
2303
2239
|
"Deposit reads the receiver through `_^`, so an argument that holds fields of",
|
|
2304
2240
|
"the same names deposits by its Size and nothing else",
|
|
2305
2241
|
"```",
|
|
2306
2242
|
"; “” (d [.count 50; .left 99; .phase 1; .s 100; 4])",
|
|
2307
|
-
"# “Denum(1,4,0)”",
|
|
2308
|
-
"; “” ((Denum [2, 5, 3]) [.count 50; .left 99; .right 7; 4])",
|
|
2309
|
-
"# “Denum(3,9,3)”",
|
|
2243
|
+
"# “Denum(1,[4, 0])”",
|
|
2244
|
+
"; “” ((Denum [2, [5, 3]]) [.count 50; .left 99; .right 7; 4])",
|
|
2245
|
+
"# “Denum(3,[9, 3])”",
|
|
2310
2246
|
"```",
|
|
2311
2247
|
"A Denum captured by a closure, mapped, or reduced is applied the same way, and",
|
|
2312
2248
|
"the captured one stays as it was",
|
|
2313
2249
|
"```",
|
|
2314
|
-
"; .start (Denum [0, 0, 0]); .step {start _};",
|
|
2250
|
+
"; .start (Denum [0, [0, 0]]); .step {start _};",
|
|
2315
2251
|
"; [“” (step 5), “” (step 3), “” start]",
|
|
2316
|
-
"# [“Denum(1,5,0)”, “Denum(1,3,0)”, “Denum(0,0,0)”]",
|
|
2252
|
+
"# [“Denum(1,[5, 0])”, “Denum(1,[3, 0])”, “Denum(0,[0, 0])”]",
|
|
2317
2253
|
"; [d, a] & {“” (_ 5)}",
|
|
2318
|
-
"# [“Denum(1,5,0)”, “Denum(3,10,3)”]",
|
|
2319
|
-
"; “” ([5, 3, 7] | (Denum [0, 0, 0]))",
|
|
2320
|
-
"# “Denum(3,12,3)”",
|
|
2254
|
+
"# [“Denum(1,[5, 0])”, “Denum(3,[10, 3])”]",
|
|
2255
|
+
"; “” ([5, 3, 7] | (Denum [0, [0, 0]]))",
|
|
2256
|
+
"# “Denum(3,[12, 3])”",
|
|
2321
2257
|
"```",
|
|
2322
2258
|
"Through a mutable name, application writes the Denum in place",
|
|
2323
2259
|
"```",
|
|
2324
|
-
"; .m_ (Denum [0, 0, 0]);",
|
|
2260
|
+
"; .m_ (Denum [0, [0, 0]]);",
|
|
2325
2261
|
"; m_ 5;",
|
|
2326
2262
|
"; m_ 3;",
|
|
2327
|
-
"; [“” m_, m_.count, m_
|
|
2328
|
-
"# [“Denum(2,5,3)”, 2,
|
|
2263
|
+
"; [“” m_, m_.count, m_.# %% 2]",
|
|
2264
|
+
"# [“Denum(2,[5, 3])”, 2, 0]",
|
|
2329
2265
|
"```",
|
|
2330
2266
|
"## Application counts",
|
|
2331
2267
|
"",
|
|
2332
|
-
"Starting at Count 0
|
|
2333
|
-
"
|
|
2334
|
-
"
|
|
2268
|
+
"Starting at Count 0 or at Count 1, applying 5, 3, 7 and 2 in turn grows the",
|
|
2269
|
+
"Count by exactly one each time and alternates the load. The Size and residual",
|
|
2270
|
+
"are the alternating route's, from load 0 or from load 1",
|
|
2335
2271
|
"```",
|
|
2336
2272
|
"; .chain {.s _; [s, (s 5), ((s 5) 3), (((s 5) 3) 7), ((((s 5) 3) 7) 2)]};",
|
|
2337
|
-
"; .c0 (chain (Denum [0, 0, 0])); .c1 (chain (Denum [1, 0, 0]));",
|
|
2338
|
-
"; [c0 & {_.count}, c0 & {_
|
|
2339
|
-
"# [[0, 1, 2, 3, 4], [
|
|
2340
|
-
"; [c1 & {_.count}, c1 & {_
|
|
2341
|
-
"# [[1, 2, 3, 4, 5], [1,
|
|
2273
|
+
"; .c0 (chain (Denum [0, [0, 0]])); .c1 (chain (Denum [1, [0, 0]]));",
|
|
2274
|
+
"; [c0 & {_.count}, c0 & {_.# %% 2}, c0 & {_.##}, c0 & {_.###}]",
|
|
2275
|
+
"# [[0, 1, 2, 3, 4], [0, 1, 0, 1, 0], [0, 5, 8, 15, 17], [0, 5, 2, 9, 7]]",
|
|
2276
|
+
"; [c1 & {_.count}, c1 & {_.# %% 2}, c1 & {_.##}, c1 & {_.###}]",
|
|
2277
|
+
"# [[1, 2, 3, 4, 5], [1, 0, 1, 0, 1], [0, 5, 8, 15, 17], [0, -5, -2, -9, -7]]",
|
|
2342
2278
|
"```",
|
|
2343
2279
|
"The Count and the loads together are the state, and the fourth hash of each step",
|
|
2344
2280
|
"is that step, Count included",
|
|
@@ -2349,26 +2285,26 @@ export const HC_SOURCES = new Map([
|
|
|
2349
2285
|
"## Observers",
|
|
2350
2286
|
"",
|
|
2351
2287
|
"A Denum's Count is its stored Count, its Size the total load and its residual the",
|
|
2352
|
-
"signed difference, including a present zero-load Denum in either
|
|
2288
|
+
"signed difference, including a present zero-load Denum in either parity",
|
|
2353
2289
|
"```",
|
|
2354
|
-
"; .e (Denum [3, 12, 3]);",
|
|
2355
|
-
"; [e.#, e.##, e.###, e
|
|
2290
|
+
"; .e (Denum [3, [12, 3]]);",
|
|
2291
|
+
"; [e.#, e.##, e.###, e.# %% 2]",
|
|
2356
2292
|
"# [3, 15, 9, 1]",
|
|
2357
|
-
"; [d.#, d.##, d.###, (Denum [1, 0, 0]).#, (Denum [1, 0, 0])
|
|
2293
|
+
"; [d.#, d.##, d.###, (Denum [1, [0, 0]]).#, (Denum [1, [0, 0]]).# %% 2]",
|
|
2358
2294
|
"# [0, 0, 0, 1, 1]",
|
|
2359
2295
|
"```",
|
|
2360
|
-
"Count is `.#`, not
|
|
2296
|
+
"Count is `.#`, not its parity. The same parity and loads with a different Count are",
|
|
2361
2297
|
"different states with the same Size and residual",
|
|
2362
2298
|
"```",
|
|
2363
|
-
"; .f2 (Denum [2, 5, 1]); .f4 (Denum [4, 5, 1]);",
|
|
2364
|
-
"; [(f2
|
|
2299
|
+
"; .f2 (Denum [2, [5, 1]]); .f4 (Denum [4, [5, 1]]);",
|
|
2300
|
+
"; [(f2.# %% 2) = (f4.# %% 2), f2.## = f4.##, f2.### = f4.###, f2.# = f4.#, f2 = f4, f2 = (Denum [2, [5, 1]])]",
|
|
2365
2301
|
"# [<>, <>, <>, (), (), <>]",
|
|
2366
|
-
"; [f2.#, f4.#, f2.##, f2.###, f2
|
|
2367
|
-
"# [2, 4, 6, 4,
|
|
2302
|
+
"; [f2.#, f4.#, f2.##, f2.###, f2.# %% 2, f4.# %% 2]",
|
|
2303
|
+
"# [2, 4, 6, 4, 0, 0]",
|
|
2368
2304
|
"```",
|
|
2369
2305
|
"A Denum inside an aggregate contributes its declared Size",
|
|
2370
2306
|
"```",
|
|
2371
|
-
"; [[e, e].##, [e, d].###, [e].#### = (Denum [1, 15, 0])]",
|
|
2307
|
+
"; [[e, e].##, [e, d].###, [e].#### = (Denum [1, [15, 0]])]",
|
|
2372
2308
|
"# [30, 15, <>]",
|
|
2373
2309
|
"```",
|
|
2374
2310
|
"## The fourth hash",
|
|
@@ -2379,7 +2315,7 @@ export const HC_SOURCES = new Map([
|
|
|
2379
2315
|
"```",
|
|
2380
2316
|
"; [e.#### = e, e.#### === e, e.#### == e, ((e.####).####).#### = e, (e.####).# = e.#]",
|
|
2381
2317
|
"# [<>, (), <>, <>, <>]",
|
|
2382
|
-
"; [d.#### = d, (Denum [1, 0, 0]).#### = (Denum [1, 0, 0]), (Denum [100, 5, 3]).####.count, (Denum [0, 3, 0]).#### = (Denum [0, 3, 0])]",
|
|
2318
|
+
"; [d.#### = d, (Denum [1, [0, 0]]).#### = (Denum [1, [0, 0]]), (Denum [100, [5, 3]]).####.count, (Denum [0, [3, 0]]).#### = (Denum [0, [3, 0]])]",
|
|
2383
2319
|
"# [<>, <>, 100, <>]",
|
|
2384
2320
|
"; [f2.####.# , f4.####.#, f2.#### = f4.####, f2.#### = f2]",
|
|
2385
2321
|
"# [2, 4, (), <>]",
|
|
@@ -2388,17 +2324,17 @@ export const HC_SOURCES = new Map([
|
|
|
2388
2324
|
"so it compares equal to one built here. The host's whole Count is kept: it is",
|
|
2389
2325
|
"not reduced to its parity",
|
|
2390
2326
|
"```",
|
|
2391
|
-
"; [[5, 3].#### = (Denum [2, 5, 3]), “hello”.#### = (Denum [5, 3, 2]), [0].#### = (Denum [1, 0, 0])]",
|
|
2327
|
+
"; [[5, 3].#### = (Denum [2, [5, 3]]), “hello”.#### = (Denum [5, [3, 2]]), [0].#### = (Denum [1, [0, 0]])]",
|
|
2392
2328
|
"# [<>, <>, <>]",
|
|
2393
|
-
"; [[5, 3].####.#, “hello”.####.#, “hello
|
|
2329
|
+
"; [[5, 3].####.#, “hello”.####.#, “hello”.#### .# %% 2, [5, 3, 7].####.#, [5, 3, 7].#### .# %% 2]",
|
|
2394
2330
|
"# [2, 5, 1, 3, 1]",
|
|
2395
2331
|
"; “” [5, 3, 7].####",
|
|
2396
|
-
"# “Denum(3,12,3)”",
|
|
2332
|
+
"# “Denum(3,[12, 3])”",
|
|
2397
2333
|
"```",
|
|
2398
2334
|
"Hosts whose Counts differ by an even number do not share a fourth hash, though",
|
|
2399
|
-
"they share
|
|
2335
|
+
"they share parity and, here, loads",
|
|
2400
2336
|
"```",
|
|
2401
|
-
"; [[5, 3].#### = [5, 3, 0, 0].####, ([5, 3]
|
|
2337
|
+
"; [[5, 3].#### = [5, 3, 0, 0].####, ([5, 3].#### .# %% 2) = ([5, 3, 0, 0].#### .# %% 2), [5, 3].####.## = [5, 3, 0, 0].####.##]",
|
|
2402
2338
|
"# [(), <>, <>]",
|
|
2403
2339
|
"```",
|
|
2404
2340
|
"It is nil where there is no Denum: an empty host, Count zero, no Count, or no",
|
|
@@ -2409,24 +2345,24 @@ export const HC_SOURCES = new Map([
|
|
|
2409
2345
|
"; [[].####, 0.####, ().####, <2,3,5>.####, “”.####]",
|
|
2410
2346
|
"# [(), (), (), (), ()]",
|
|
2411
2347
|
"; .shared [1, 2];",
|
|
2412
|
-
"; [[.a 100; 5, 3].#### = [5, 3].####, [shared, shared].#### = (Denum [2, 3, 3]), (5, 3).#### = (Denum [2, 5, 3])]",
|
|
2348
|
+
"; [[.a 100; 5, 3].#### = [5, 3].####, [shared, shared].#### = (Denum [2, [3, 3]]), (5, 3).#### = (Denum [2, [5, 3]])]",
|
|
2413
2349
|
"# [<>, <>, <>]",
|
|
2414
2350
|
"```",
|
|
2415
|
-
"The two zero-Count cases are different. A constructed `Denum [0, 0, 0]` is a",
|
|
2351
|
+
"The two zero-Count cases are different. A constructed `Denum [0, [0, 0]]` is a",
|
|
2416
2352
|
"present value, while the empty host and the Count 0 have none. They agree on",
|
|
2417
2353
|
"Count, Size and residual, so the difference is not read from the observers: the",
|
|
2418
2354
|
"fourth hash recognizes an instance of this class (007.25e)",
|
|
2419
2355
|
"```",
|
|
2420
2356
|
"; [[].# = d.#, [].## = d.##, 0.## = d.##, 0.### = d.###]",
|
|
2421
2357
|
"# [<>, (), <>, <>]",
|
|
2422
|
-
"; [[].#### = (), 0.#### = (), d.#### = d, ((Denum [0, 0, 0]).####).count]",
|
|
2358
|
+
"; [[].#### = (), 0.#### = (), d.#### = d, ((Denum [0, [0, 0]]).####).count]",
|
|
2423
2359
|
"# [<>, <>, <>, 0]",
|
|
2424
2360
|
"```",
|
|
2425
2361
|
"Zero-Count Denums reached without an application are present too, and so is",
|
|
2426
2362
|
"each functional update of one",
|
|
2427
2363
|
"```",
|
|
2428
|
-
"; [“” ((Denum [0, 3, 0]).####), “” ((d + 4).####), “” ((d - 2.5).####), “” ((d * 7).####)]",
|
|
2429
|
-
"# [“Denum(0,3,0)”, “Denum(0,0,4)”, “Denum(0,2,0)”, “Denum(0,0,0)”]",
|
|
2364
|
+
"; [“” ((Denum [0, [3, 0]]).####), “” ((d + 4).####), “” ((d - 2.5).####), “” ((d * 7).####)]",
|
|
2365
|
+
"# [“Denum(0,[3, 0])”, “Denum(0,[0, 4])”, “Denum(0,[2, 0])”, “Denum(0,[0, 0])”]",
|
|
2430
2366
|
"```",
|
|
2431
2367
|
"## Only a Denum is a Denum",
|
|
2432
2368
|
"",
|
|
@@ -2438,28 +2374,28 @@ export const HC_SOURCES = new Map([
|
|
|
2438
2374
|
"```",
|
|
2439
2375
|
"; .noted_ [.n 0; .bump_ {@n (_^.n + 1);}];",
|
|
2440
2376
|
"; .Liar [.#### {[.# {0}; .## {0}; .### {0}]}];",
|
|
2441
|
-
"; .Loud [.#### {noted_.bump_ (); Denum [0, 0, 0]}];",
|
|
2377
|
+
"; .Loud [.#### {noted_.bump_ (); Denum [0, [0, 0]]}];",
|
|
2442
2378
|
"; .Selfish [.#### {_^.####}];",
|
|
2443
2379
|
"; .Broken [.#### {[].nope}];",
|
|
2444
2380
|
"; [Liar.####, Loud.####, Selfish.####, Broken.####, noted_.n]",
|
|
2445
2381
|
"# [(), (), (), (), 0]",
|
|
2446
|
-
"; [“” ([.#### {Denum [9, 9, 9]}; 5, 3].####), [.#### {Denum [9, 9, 9]}; 5, 3].#### = [5, 3].####]",
|
|
2447
|
-
"# [“Denum(2,5,3)”, <>]",
|
|
2382
|
+
"; [“” ([.#### {Denum [9, [9, 9]]}; 5, 3].####), [.#### {Denum [9, [9, 9]]}; 5, 3].#### = [5, 3].####]",
|
|
2383
|
+
"# [“Denum(2,[5, 3])”, <>]",
|
|
2448
2384
|
"```",
|
|
2449
2385
|
"Forged observers do not make a Denum. An aggregate declaring Count, Size and",
|
|
2450
|
-
"residual 0, 0, 0 reads exactly as `Denum [0, 0, 0]` does, and still has no Denum,",
|
|
2386
|
+
"residual 0, 0, 0 reads exactly as `Denum [0, [0, 0]]` does, and still has no Denum,",
|
|
2451
2387
|
"because it is not one; with a nonzero Count it gets the derived Denum of those",
|
|
2452
2388
|
"observers, a fresh instance of this class, never the aggregate itself",
|
|
2453
2389
|
"```",
|
|
2454
2390
|
"; .Zero [.# {0}; .## {0}; .### {0}];",
|
|
2455
2391
|
"; .Three [.# {3}; .## {5}; .### {1}];",
|
|
2456
2392
|
"; [[Zero.#, Zero.##, Zero.###] = [d.#, d.##, d.###], Zero.####, “” Three.####, Three.#### = Three]",
|
|
2457
|
-
"# [<>, (), “Denum(3,3,2)”, ()]",
|
|
2393
|
+
"# [<>, (), “Denum(3,[3, 2])”, ()]",
|
|
2458
2394
|
"```",
|
|
2459
2395
|
"Fields named like a Denum's are not enough either. Recognition compares the",
|
|
2460
2396
|
"whole instance, fields and methods, by typed equality `==` with the Denum the",
|
|
2461
2397
|
"constructor builds from the stored `count` and `loads`. So a bare record",
|
|
2462
|
-
"of those fields,
|
|
2398
|
+
"of those fields, a record in the old shape with a stored phase, one whose Count is a",
|
|
2463
2399
|
"decimal, and one that adds a field are foreign, and with Count zero they have",
|
|
2464
2400
|
"no Denum",
|
|
2465
2401
|
"```",
|
|
@@ -2472,8 +2408,8 @@ export const HC_SOURCES = new Map([
|
|
|
2472
2408
|
"A Denum with a Count is recognized as one, and what it answers is a fresh",
|
|
2473
2409
|
"reconstruction from its stored state, equal to it and not it",
|
|
2474
2410
|
"```",
|
|
2475
|
-
"; [(Denum [3, 5, 1]).#### == (Denum [3, 5, 1]), (Denum [3, 5, 1]).#### === (Denum [3, 5, 1]), “” (Denum [3, 5, 1]).####]",
|
|
2476
|
-
"# [<>, (), “Denum(3,5,1)”]",
|
|
2411
|
+
"; [(Denum [3, [5, 1]]).#### == (Denum [3, [5, 1]]), (Denum [3, [5, 1]]).#### === (Denum [3, [5, 1]]), “” (Denum [3, [5, 1]]).####]",
|
|
2412
|
+
"# [<>, (), “Denum(3,[5, 1])”]",
|
|
2477
2413
|
"```",
|
|
2478
2414
|
"## Observing commutes with applying",
|
|
2479
2415
|
"",
|
|
@@ -2490,18 +2426,18 @@ export const HC_SOURCES = new Map([
|
|
|
2490
2426
|
"Count zero restores it: that is the initialized-router reading, and it is also",
|
|
2491
2427
|
"what a reduce starts from",
|
|
2492
2428
|
"```",
|
|
2493
|
-
"; [([] 7).#### = ([].#### 7), ([] 7).#### = ((Denum [0, 0, 0]) 7), ([] 7).#### = ([7] | (Denum [0, 0, 0]))]",
|
|
2429
|
+
"; [([] 7).#### = ([].#### 7), ([] 7).#### = ((Denum [0, [0, 0]]) 7), ([] 7).#### = ([7] | (Denum [0, [0, 0]]))]",
|
|
2494
2430
|
"# [(), <>, <>]",
|
|
2495
|
-
"; [] | (Denum [0, 0, 0]) = (Denum [0, 0, 0])",
|
|
2431
|
+
"; [] | (Denum [0, [0, 0]]) = (Denum [0, [0, 0]])",
|
|
2496
2432
|
"# <>",
|
|
2497
2433
|
"```",
|
|
2498
2434
|
"## Scaling and Star",
|
|
2499
2435
|
"",
|
|
2500
|
-
"Scaling multiplies
|
|
2436
|
+
"Scaling multiplies every load and keeps the Count: zero annihilates,",
|
|
2501
2437
|
"one is the identity, and scaling composes",
|
|
2502
2438
|
"```",
|
|
2503
2439
|
"; [“” (e.scale_ 2), “” (e.scale_ 0), (e.scale_ 1) = e, ((e.scale_ 2).scale_ 3) = (e.scale_ 6), (e.scale_ 2).#]",
|
|
2504
|
-
"# [“Denum(3,24,6)”, “Denum(3,0,0)”, <>, <>, 3]",
|
|
2440
|
+
"# [“Denum(3,[24, 6])”, “Denum(3,[0, 0])”, <>, <>, 3]",
|
|
2505
2441
|
"; e.scale_ (0 - 2)",
|
|
2506
2442
|
"# $!!.invalid-scale",
|
|
2507
2443
|
"```",
|
|
@@ -2516,42 +2452,42 @@ export const HC_SOURCES = new Map([
|
|
|
2516
2452
|
"Size observer `x.##`. They are fixed-channel load transformations consistent",
|
|
2517
2453
|
"with a `RotorRouter`'s channel loads (`hc/rotor-router.hc`), not named Router",
|
|
2518
2454
|
"methods. `+`, `-` and `*` **construct a fresh Denum** from observations of their",
|
|
2519
|
-
"operands: `+` is tally, depositing `x.##` on
|
|
2520
|
-
"depositing on
|
|
2521
|
-
"`scale_`, the Star shadow. Each keeps the Count,
|
|
2455
|
+
"operands: `+` is tally, depositing `x.##` on load 1; `-` is alternator,",
|
|
2456
|
+
"depositing on load 0; and `*` is inlay, scaling every load by `x.##` through",
|
|
2457
|
+
"`scale_`, the Star shadow. Each keeps the Count, answers a",
|
|
2522
2458
|
"fresh value and leaves its operand as it was, so they compose by nesting",
|
|
2523
2459
|
"```",
|
|
2524
|
-
"; .D (Denum [2, 5, 3]);",
|
|
2460
|
+
"; .D (Denum [2, [5, 3]]);",
|
|
2525
2461
|
"; [“” (D + 4), “” (D - 4), “” (D * 3)]",
|
|
2526
|
-
"# [“Denum(2,5,7)”, “Denum(2,9,3)”, “Denum(2,15,9)”]",
|
|
2462
|
+
"# [“Denum(2,[5, 7])”, “Denum(2,[9, 3])”, “Denum(2,[15, 9])”]",
|
|
2527
2463
|
"; [“” ((D + 4) - 2), “” ((D - 2) + 4), “” ((D + 4) * 3)]",
|
|
2528
|
-
"# [“Denum(2,7,7)”, “Denum(2,7,7)”, “Denum(2,15,21)”]",
|
|
2464
|
+
"# [“Denum(2,[7, 7])”, “Denum(2,[7, 7])”, “Denum(2,[15, 21])”]",
|
|
2529
2465
|
"; “” D",
|
|
2530
|
-
"# “Denum(2,5,3)”",
|
|
2466
|
+
"# “Denum(2,[5, 3])”",
|
|
2531
2467
|
"```",
|
|
2532
|
-
"A deposit keeps the Count
|
|
2533
|
-
"
|
|
2468
|
+
"A deposit keeps the Count, including an odd one, where application would",
|
|
2469
|
+
"change its parity, and a zero Size deposits nothing while still answering a Denum. The",
|
|
2534
2470
|
"operand is measured by its Size, so any sized Frame deposits",
|
|
2535
2471
|
"```",
|
|
2536
|
-
"; [(D + 4).#, (D - 4).#, (D * 3).#, (D + 4).count, (D + 4)
|
|
2537
|
-
"# [2, 2, 2, 2,
|
|
2538
|
-
"; .P (Denum [1, 5, 3]);",
|
|
2539
|
-
"; [“” (P + 4), (P + 4).#, (P + 4)
|
|
2540
|
-
"# [“Denum(1,5,7)”, 1, 1, “Denum(1,9,3)”]",
|
|
2472
|
+
"; [(D + 4).#, (D - 4).#, (D * 3).#, (D + 4).count, (D + 4).# %% 2]",
|
|
2473
|
+
"# [2, 2, 2, 2, 0]",
|
|
2474
|
+
"; .P (Denum [1, [5, 3]]);",
|
|
2475
|
+
"; [“” (P + 4), (P + 4).#, (P + 4).# %% 2, “” (P - 4)]",
|
|
2476
|
+
"# [“Denum(1,[5, 7])”, 1, 1, “Denum(1,[9, 3])”]",
|
|
2541
2477
|
"; [“” (D + 0), “” (D - 0), “” (D [3, 4])]",
|
|
2542
|
-
"# [“Denum(2,5,3)”, “Denum(2,5,3)”, “Denum(3,12,3)”]",
|
|
2478
|
+
"# [“Denum(2,[5, 3])”, “Denum(2,[5, 3])”, “Denum(3,[12, 3])”]",
|
|
2543
2479
|
"```",
|
|
2544
2480
|
"Deposit is not application and deposit is not subtraction. `D x` adds one to the",
|
|
2545
|
-
"Count and
|
|
2546
|
-
"states; `D - x` adds to
|
|
2481
|
+
"Count and changes its parity, and `D + x` does not, so they reach different",
|
|
2482
|
+
"states; `D - x` adds to load 0 and never takes from load 1, so a load",
|
|
2547
2483
|
"stays a whole Count and the signed residual only rises",
|
|
2548
2484
|
"```",
|
|
2549
2485
|
"; [(D + 4).###, (D - 4).###, D.###]",
|
|
2550
2486
|
"# [-2, 6, 2]",
|
|
2551
|
-
"; [((D 4).# = (D + 4).#), (D 4).###, (D + 4).###, (D 4).#, (D 4)
|
|
2487
|
+
"; [((D 4).# = (D + 4).#), (D 4).###, (D + 4).###, (D 4).#, (D 4).# %% 2]",
|
|
2552
2488
|
"# [(), 6, -2, 3, 1]",
|
|
2553
2489
|
"```",
|
|
2554
|
-
"Order of a
|
|
2490
|
+
"Order of a load-1 then a load-0 deposit does not matter, and scaling after a",
|
|
2555
2491
|
"balanced deposit is the Star shadow of scaling first",
|
|
2556
2492
|
"```",
|
|
2557
2493
|
"; [((D + 4) - 2) = ((D - 2) + 4), ((D + 4) * 3) = ((D * 3) + 12)]",
|
|
@@ -2570,27 +2506,27 @@ export const HC_SOURCES = new Map([
|
|
|
2570
2506
|
"`+` and `-` read their operand through the one Size observer as `*` does, so",
|
|
2571
2507
|
"any sized Frame deposits its Size: a decimal its truncated magnitude, text its",
|
|
2572
2508
|
"characters, an aggregate its element count, a Denum `L + R`, and a closure one",
|
|
2573
|
-
"per word. These are the review's own examples, from `Denum [0, 0, 0]`",
|
|
2509
|
+
"per word. These are the review's own examples, from `Denum [0, [0, 0]]`",
|
|
2574
2510
|
"```",
|
|
2575
2511
|
"; [(2.5).##, (1.5).##, (0 - 1.5).##]",
|
|
2576
2512
|
"# [2, 1, 1]",
|
|
2577
|
-
"; [“” ((Denum [0, 0, 0]) + 2), “” ((Denum [0, 0, 0]) + 2.5), “” ((Denum [0, 0, 0]) - 1.5), “” ((Denum [1, 2, 2]) * 2.5)]",
|
|
2578
|
-
"# [“Denum(0,0,2)”, “Denum(0,0,2)”, “Denum(0,1,0)”, “Denum(1,4,4)”]",
|
|
2513
|
+
"; [“” ((Denum [0, [0, 0]]) + 2), “” ((Denum [0, [0, 0]]) + 2.5), “” ((Denum [0, [0, 0]]) - 1.5), “” ((Denum [1, [2, 2]]) * 2.5)]",
|
|
2514
|
+
"# [“Denum(0,[0, 2])”, “Denum(0,[0, 2])”, “Denum(0,[1, 0])”, “Denum(1,[4, 4])”]",
|
|
2579
2515
|
"; [“” (D + 2.5), “” (D - 2.5), “” (P + 0.5), “” (P - (0 - 3.5))]",
|
|
2580
|
-
"# [“Denum(2,5,5)”, “Denum(2,7,3)”, “Denum(1,5,3)”, “Denum(1,8,3)”]",
|
|
2581
|
-
"; [“” (D + “abc”), “” (D - [[], []]), “” (D + (Denum [1, 2, 4])), “” (D - {5 + 3}), “” (D + <>), “” (D - [])]",
|
|
2582
|
-
"# [“Denum(2,5,6)”, “Denum(2,7,3)”, “Denum(2,5,9)”, “Denum(2,14,3)”, “Denum(2,5,4)”, “Denum(2,6,3)”]",
|
|
2516
|
+
"# [“Denum(2,[5, 5])”, “Denum(2,[7, 3])”, “Denum(1,[5, 3])”, “Denum(1,[8, 3])”]",
|
|
2517
|
+
"; [“” (D + “abc”), “” (D - [[], []]), “” (D + (Denum [1, [2, 4]])), “” (D - {5 + 3}), “” (D + <>), “” (D - [])]",
|
|
2518
|
+
"# [“Denum(2,[5, 6])”, “Denum(2,[7, 3])”, “Denum(2,[5, 9])”, “Denum(2,[14, 3])”, “Denum(2,[5, 4])”, “Denum(2,[6, 3])”]",
|
|
2583
2519
|
"```",
|
|
2584
|
-
"Each keeps the full Count,
|
|
2520
|
+
"Each keeps the full Count, in both parities; leaves the",
|
|
2585
2521
|
"receiver as it was, even through a mutable name; and refuses a sizeless operand",
|
|
2586
2522
|
"with its failure",
|
|
2587
2523
|
"```",
|
|
2588
|
-
"; [(D + 2.5).#, (D + 2.5)
|
|
2589
|
-
"# [2,
|
|
2590
|
-
"; .q_ (Denum [2, 5, 3]);",
|
|
2524
|
+
"; [(D + 2.5).#, (D + 2.5).# %% 2, (P - 1.5).#, (P - 1.5).# %% 2, “” D, “” P]",
|
|
2525
|
+
"# [2, 0, 1, 1, “Denum(2,[5, 3])”, “Denum(1,[5, 3])”]",
|
|
2526
|
+
"; .q_ (Denum [2, [5, 3]]);",
|
|
2591
2527
|
"; [“” (q_ + 2.5), “” (q_ - 2.5), “” (q_ * 2.5), “” q_]",
|
|
2592
|
-
"# [“Denum(2,5,5)”, “Denum(2,7,3)”, “Denum(2,10,6)”, “Denum(2,5,3)”]",
|
|
2593
|
-
"; [D + ([2.5].nope), D - ([2.5].nope), (Denum [0, 0, 0]) + ([].nope)]",
|
|
2528
|
+
"# [“Denum(2,[5, 5])”, “Denum(2,[7, 3])”, “Denum(2,[10, 6])”, “Denum(2,[5, 3])”]",
|
|
2529
|
+
"; [D + ([2.5].nope), D - ([2.5].nope), (Denum [0, [0, 0]]) + ([].nope)]",
|
|
2594
2530
|
"# [$!.name-missing “..., $!.name-missing “..., $!.name-missing “...]",
|
|
2595
2531
|
"```",
|
|
2596
2532
|
"The argument cannot reach the receiver's names. A decimal is unit-taggable,",
|
|
@@ -2601,23 +2537,26 @@ export const HC_SOURCES = new Map([
|
|
|
2601
2537
|
"; (2.5).Denum",
|
|
2602
2538
|
"# 2.5.Denum",
|
|
2603
2539
|
"; [“” (D + [.Denum 9; .right 99; .left 99; .count 7; .k 50; 4]), “” (D - [.Denum 9; .left 99; .l 99; .s 50; 4])]",
|
|
2604
|
-
"# [“Denum(2,5,7)”, “Denum(2,9,3)”]",
|
|
2540
|
+
"# [“Denum(2,[5, 7])”, “Denum(2,[9, 3])”]",
|
|
2605
2541
|
"```",
|
|
2606
|
-
"The
|
|
2607
|
-
"deposit is not a Denum",
|
|
2542
|
+
"The deposit behind them takes a load index and a Count, for any arity, so a",
|
|
2543
|
+
"negative or fractional deposit is not a Denum and an index past the loads is",
|
|
2544
|
+
"refused",
|
|
2608
2545
|
"```",
|
|
2609
|
-
"; [D.
|
|
2610
|
-
"# [
|
|
2546
|
+
"; [“” (D.deposit_ [1, 2]), “” (D.deposit_ [0, 2]), “” ((Denum [0, [1, 2, 3]]).deposit_ [2, 4]), “” D]",
|
|
2547
|
+
"# [“Denum(2,[5, 5])”, “Denum(2,[7, 3])”, “Denum(0,[1, 2, 7])”, “Denum(2,[5, 3])”]",
|
|
2548
|
+
"; [D.deposit_ [1, (0 - 1)], D.deposit_ [0, 2.5], D.deposit_ 2, D.deposit_ [1, 2, 3], D.deposit_ [2, 1], D.deposit_ [(0 - 1), 1], D.deposit_ [“a”, 1]]",
|
|
2549
|
+
"# [$!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-arity, $!!.invalid-arity, $!!.invalid-arity]",
|
|
2611
2550
|
"```",
|
|
2612
2551
|
"`*` scales by the operand's Size, so its domain is every sized Frame: a Denum",
|
|
2613
2552
|
"contributes `L + R`, an aggregate its element count, a decimal its truncated",
|
|
2614
2553
|
"magnitude, and a zero Size annihilates both loads. `D * 3` is unchanged, since",
|
|
2615
2554
|
"`3.## = 3`, and the result keeps the Count in either parity",
|
|
2616
2555
|
"```",
|
|
2617
|
-
"; [“” (D * (Denum [1, 2, 4])), “” (D * [[], []]), “” (D * 2.5), “” (D * 0)]",
|
|
2618
|
-
"# [“Denum(2,30,18)”, “Denum(2,10,6)”, “Denum(2,10,6)”, “Denum(2,0,0)”]",
|
|
2556
|
+
"; [“” (D * (Denum [1, [2, 4]])), “” (D * [[], []]), “” (D * 2.5), “” (D * 0)]",
|
|
2557
|
+
"# [“Denum(2,[30, 18])”, “Denum(2,[10, 6])”, “Denum(2,[10, 6])”, “Denum(2,[0, 0])”]",
|
|
2619
2558
|
"; [“” (D * 1), (D * 3).#, (P * 3).#, “” (P * 3)]",
|
|
2620
|
-
"# [“Denum(2,5,3)”, 2, 1, “Denum(1,15,9)”]",
|
|
2559
|
+
"# [“Denum(2,[5, 3])”, 2, 1, “Denum(1,[15, 9])”]",
|
|
2621
2560
|
"```",
|
|
2622
2561
|
"The signed-scalar reading misleads: `+` lowers the residual and `-` raises it,",
|
|
2623
2562
|
"so `D + 4` is not “larger” than `D`, and `D - 4` is not `D` made smaller",
|
|
@@ -2629,11 +2568,11 @@ export const HC_SOURCES = new Map([
|
|
|
2629
2568
|
"Count and can leave a zero Count over nonzero loads. That state is present, and",
|
|
2630
2569
|
"its Size and residual read",
|
|
2631
2570
|
"```",
|
|
2632
|
-
"; .Y ((Denum [0, 0, 0]) + 4);",
|
|
2633
|
-
"; [“” Y, “” ((Denum [0, 0, 0]) - 4), Y.count, Y
|
|
2634
|
-
"# [“Denum(0,0,4)”, “Denum(0,4,0)”, 0,
|
|
2635
|
-
"; [“” (D * 3), (D.scale_ 2).#, ((D + 4) 1).#, ((D + 4) 1)
|
|
2636
|
-
"# [“Denum(2,15,9)”, 2, 3, 1]",
|
|
2571
|
+
"; .Y ((Denum [0, [0, 0]]) + 4);",
|
|
2572
|
+
"; [“” Y, “” ((Denum [0, [0, 0]]) - 4), Y.count, Y.# %% 2, Y.##, Y.###]",
|
|
2573
|
+
"# [“Denum(0,[0, 4])”, “Denum(0,[4, 0])”, 0, 0, 4, -4]",
|
|
2574
|
+
"; [“” (D * 3), (D.scale_ 2).#, ((D + 4) 1).#, ((D + 4) 1).# %% 2]",
|
|
2575
|
+
"# [“Denum(2,[15, 9])”, 2, 3, 1]",
|
|
2637
2576
|
"```",
|
|
2638
2577
|
"## Rational readings",
|
|
2639
2578
|
"",
|
|
@@ -2642,7 +2581,7 @@ export const HC_SOURCES = new Map([
|
|
|
2642
2581
|
"loads swapped the Size reading is unchanged and the residual reading changes",
|
|
2643
2582
|
"sign. With `L = 5`, `R = 0` they are the improper 5/2, neither 2 nor 3",
|
|
2644
2583
|
"```",
|
|
2645
|
-
"; .A (Denum [2, 5, 1]); .B (Denum [2, 1, 5]); .D5 (Denum [2, 5, 0]);",
|
|
2584
|
+
"; .A (Denum [2, [5, 1]]); .B (Denum [2, [1, 5]]); .D5 (Denum [2, [5, 0]]);",
|
|
2646
2585
|
"; [[A.##, A.###, A.size-ratio (), A.residual-ratio ()], [B.##, B.###, B.size-ratio (), B.residual-ratio ()], [D5.##, D5.###, D5.size-ratio (), D5.residual-ratio ()]]",
|
|
2647
2586
|
"# [[6, 4, 3, 2], [6, -4, 3, -2], [5, 5, 5/2, 5/2]]",
|
|
2648
2587
|
"```",
|
|
@@ -2650,16 +2589,16 @@ export const HC_SOURCES = new Map([
|
|
|
2650
2589
|
"reduces them: 6/4 reads 3/2, 8/6 reads 4/3. At `C = 1` they are the Size and the",
|
|
2651
2590
|
"residual, and an odd Count works as an even one does",
|
|
2652
2591
|
"```",
|
|
2653
|
-
"; [(Denum [2, 3, 2]).size-ratio (), (Denum [2, 3, 2]).residual-ratio ()]",
|
|
2592
|
+
"; [(Denum [2, [3, 2]]).size-ratio (), (Denum [2, [3, 2]]).residual-ratio ()]",
|
|
2654
2593
|
"# [5/2, 1/2]",
|
|
2655
|
-
"; [(Denum [4, 6, 0]).size-ratio (), (Denum [4, 6, 0]).residual-ratio (), (Denum [4, 5, 1]).size-ratio (), (Denum [4, 5, 1]).residual-ratio ()]",
|
|
2594
|
+
"; [(Denum [4, [6, 0]]).size-ratio (), (Denum [4, [6, 0]]).residual-ratio (), (Denum [4, [5, 1]]).size-ratio (), (Denum [4, [5, 1]]).residual-ratio ()]",
|
|
2656
2595
|
"# [3/2, 3/2, 3/2, 1]",
|
|
2657
|
-
"; [(Denum [6, 10, 2]).size-ratio (), (Denum [6, 10, 2]).residual-ratio (), (Denum [3, 5, 1]).size-ratio (), (Denum [3, 5, 1]).residual-ratio ()]",
|
|
2596
|
+
"; [(Denum [6, [10, 2]]).size-ratio (), (Denum [6, [10, 2]]).residual-ratio (), (Denum [3, [5, 1]]).size-ratio (), (Denum [3, [5, 1]]).residual-ratio ()]",
|
|
2658
2597
|
"# [2, 4/3, 2, 4/3]",
|
|
2659
|
-
"; [(Denum [1, 7, 2]).size-ratio (), (Denum [1, 7, 2]).residual-ratio (), (Denum [1, 2, 7]).size-ratio (), (Denum [1, 2, 7]).residual-ratio ()]",
|
|
2598
|
+
"; [(Denum [1, [7, 2]]).size-ratio (), (Denum [1, [7, 2]]).residual-ratio (), (Denum [1, [2, 7]]).size-ratio (), (Denum [1, [2, 7]]).residual-ratio ()]",
|
|
2660
2599
|
"# [9, 5, 9, -5]",
|
|
2661
2600
|
"```",
|
|
2662
|
-
"Two Counts with the same
|
|
2601
|
+
"Two Counts with the same parity and loads give different ratios, as they are",
|
|
2663
2602
|
"different states: the ratio is what distinguishes `[2, 5, 1]` from `[4, 5, 1]`",
|
|
2664
2603
|
"beyond their identity",
|
|
2665
2604
|
"```",
|
|
@@ -2671,7 +2610,7 @@ export const HC_SOURCES = new Map([
|
|
|
2671
2610
|
"is a FrameInt, a non-whole one a FrameRational, and the residual reading is",
|
|
2672
2611
|
"signed",
|
|
2673
2612
|
"```",
|
|
2674
|
-
"; [(Denum [3, 1, 0]).size-ratio (), (Denum [3, 0, 1]).residual-ratio (), ((Denum [3, 1, 0]).size-ratio ()) * 3]",
|
|
2613
|
+
"; [(Denum [3, [1, 0]]).size-ratio (), (Denum [3, [0, 1]]).residual-ratio (), ((Denum [3, [1, 0]]).size-ratio ()) * 3]",
|
|
2675
2614
|
"# [1/3, -1/3, 1]",
|
|
2676
2615
|
"; [(A.size-ratio ()) * A.count = A.##, (A.residual-ratio ()) * A.count = A.###, (B.residual-ratio ()) * B.count = B.###, (D5.size-ratio ()) * D5.count = D5.##]",
|
|
2677
2616
|
"# [<>, <>, <>, <>]",
|
|
@@ -2679,16 +2618,16 @@ export const HC_SOURCES = new Map([
|
|
|
2679
2618
|
"# [<>, <>, (), <>, ()]",
|
|
2680
2619
|
"```",
|
|
2681
2620
|
"An empty state, a balanced nonempty one and a positive Count over empty loads all",
|
|
2682
|
-
"read zero, in either
|
|
2621
|
+
"read zero, in either parity",
|
|
2683
2622
|
"```",
|
|
2684
|
-
"; [(Denum [2, 0, 0]).size-ratio (), (Denum [1, 0, 0]).size-ratio (), (Denum [3, 0, 0]).residual-ratio ()]",
|
|
2623
|
+
"; [(Denum [2, [0, 0]]).size-ratio (), (Denum [1, [0, 0]]).size-ratio (), (Denum [3, [0, 0]]).residual-ratio ()]",
|
|
2685
2624
|
"# [0, 0, 0]",
|
|
2686
|
-
"; [(Denum [2, 3, 3]).size-ratio (), (Denum [2, 3, 3]).residual-ratio (), (Denum [1, 3, 3]).size-ratio (), (Denum [1, 3, 3]).residual-ratio ()]",
|
|
2625
|
+
"; [(Denum [2, [3, 3]]).size-ratio (), (Denum [2, [3, 3]]).residual-ratio (), (Denum [1, [3, 3]]).size-ratio (), (Denum [1, [3, 3]]).residual-ratio ()]",
|
|
2687
2626
|
"# [3, 0, 6, 0]",
|
|
2688
2627
|
"```",
|
|
2689
2628
|
"Loads too large for a machine integer give the same exact readings",
|
|
2690
2629
|
"```",
|
|
2691
|
-
"; .G (Denum [1000000007, 123456789012345678901234567890, 987654321098765432109876543210]);",
|
|
2630
|
+
"; .G (Denum [1000000007, [123456789012345678901234567890, 987654321098765432109876543210]]);",
|
|
2692
2631
|
"; [(G.size-ratio ()) * G.count = G.##, (G.residual-ratio ()) * G.count = G.###, G.###]",
|
|
2693
2632
|
"# [<>, <>, -864197532086419753208641975320]",
|
|
2694
2633
|
"```",
|
|
@@ -2698,7 +2637,7 @@ export const HC_SOURCES = new Map([
|
|
|
2698
2637
|
"and its Size and residual still read, including after loads were added without",
|
|
2699
2638
|
"any application. This is absence, not a zero, a division error or an infinity",
|
|
2700
2639
|
"```",
|
|
2701
|
-
"; .Z0 (Denum [0, 3, 0]); .Z1 (Denum [0, 0, 0]); .Z2 ((Denum [0, 0, 0]) + 4);",
|
|
2640
|
+
"; .Z0 (Denum [0, [3, 0]]); .Z1 (Denum [0, [0, 0]]); .Z2 ((Denum [0, [0, 0]]) + 4);",
|
|
2702
2641
|
"; [[Z0.##, Z0.###, Z0.size-ratio (), Z0.residual-ratio ()], [Z1.##, Z1.###, Z1.size-ratio (), Z1.residual-ratio ()], [Z2.##, Z2.###, Z2.size-ratio (), Z2.residual-ratio ()]]",
|
|
2703
2642
|
"# [[3, 3, (), ()], [0, 0, (), ()], [4, -4, (), ()]]",
|
|
2704
2643
|
"```",
|
|
@@ -2736,12 +2675,12 @@ export const HC_SOURCES = new Map([
|
|
|
2736
2675
|
"the 25 states have both readings absent",
|
|
2737
2676
|
"```",
|
|
2738
2677
|
"; .ccs [1, 2, 3, 4, 5]; .ls [0, 1, 2, 3, 4];",
|
|
2739
|
-
"; .statesP (ccs &| {.c _; ls &| {.l _; ls & {Denum [c, l, _]}}});",
|
|
2678
|
+
"; .statesP (ccs &| {.c _; ls &| {.l _; ls & {Denum [c, [l, _]]}}});",
|
|
2740
2679
|
"; .lawP {.k _; .c (k.count); [(((k.size-ratio ()) * c) = k.##), (((k.residual-ratio ()) * c) = k.###)]};",
|
|
2741
2680
|
"; .checksP (statesP &| lawP);",
|
|
2742
2681
|
"; [statesP.#, checksP.#, checksP = (checksP & {<>})]",
|
|
2743
2682
|
"# [125, 250, <>]",
|
|
2744
|
-
"; .statesZ (ls &| {.l _; ls & {Denum [0, l, _]}});",
|
|
2683
|
+
"; .statesZ (ls &| {.l _; ls & {Denum [0, [l, _]]}});",
|
|
2745
2684
|
"; .lawZ {.k _; [(k.size-ratio () = ()), (k.residual-ratio () = ())]};",
|
|
2746
2685
|
"; .checksZ (statesZ &| lawZ);",
|
|
2747
2686
|
"; [statesZ.#, checksZ.#, checksZ = (checksZ & {<>})]",
|
|
@@ -2779,12 +2718,12 @@ export const HC_SOURCES = new Map([
|
|
|
2779
2718
|
"```",
|
|
2780
2719
|
"; Routers <- './hc/rotor-router.hc';",
|
|
2781
2720
|
"; .rr (((Routers.RotorRouter [[], []]) 5) 1);",
|
|
2782
|
-
"; .kk (((Denum [0, 0, 0]) 5) 1);",
|
|
2783
|
-
"; [rr.#, rr.##, rr.###, kk.count, kk.#, kk.##, kk.###, (rr.
|
|
2721
|
+
"; .kk (((Denum [0, [0, 0]]) 5) 1);",
|
|
2722
|
+
"; [rr.#, rr.##, rr.###, kk.count, kk.#, kk.##, kk.###, ((rr.channels .0).# + (rr.channels .1).#), rr.#### = kk.####, (rr.# %% 2) = (kk.# %% 2)]",
|
|
2784
2723
|
"# [2, 6, 4, 2, 2, 6, 4, 2, <>, <>]",
|
|
2785
2724
|
"; .r4 (((rr 7) 2)); .k4 (((kk 7) 2));",
|
|
2786
|
-
"; [r4.#, k4.count, r4
|
|
2787
|
-
"# [4, 4,
|
|
2725
|
+
"; [r4.#, k4.count, (r4.# %% 2), k4.# %% 2, r4.#### = k4.####, (k4.size-ratio ()), (k4.residual-ratio ())]",
|
|
2726
|
+
"# [4, 4, 0, 0, <>, 15/4, 9/4]",
|
|
2788
2727
|
"```",
|
|
2789
2728
|
"## Count binding, `.#%`",
|
|
2790
2729
|
"",
|
|
@@ -2799,8 +2738,8 @@ export const HC_SOURCES = new Map([
|
|
|
2799
2738
|
"```",
|
|
2800
2739
|
"; [“” ((Denum [3, [2, 5]]).#%), “” ((Denum [3, [2, 5, 3]]).#%), “” ((Denum [3, [2, 5, 3, 7]]).#%), “” ((Denum [3, [2, 5, 3, 7, 4]]).#%)]",
|
|
2801
2740
|
"# [“Denum(3,[2, 5, 0])”, “Denum(3,[2, 5, 3])”, “Denum(3,[9, 5, 3])”, “Denum(3,[9, 9, 3])”]",
|
|
2802
|
-
"; [“” ((Denum [[2, 5, 3, 7, 4]]).#%), “” ((Denum [4, [6]]).#%), “” ((Denum [2, [4]]).#%), “” ((Denum [3, [0, 0, 0, 0, 0]]).#%), “” ((Denum [2, 5, 3]).#%)]",
|
|
2803
|
-
"# [“Denum(1,[21])”, “Denum(4,[6, 0, 0, 0])”, “Denum(2,4,0)”, “Denum(3,[0, 0, 0])”, “Denum(2,5,3)”]",
|
|
2741
|
+
"; [“” ((Denum [[2, 5, 3, 7, 4]]).#%), “” ((Denum [4, [6]]).#%), “” ((Denum [2, [4]]).#%), “” ((Denum [3, [0, 0, 0, 0, 0]]).#%), “” ((Denum [2, [5, 3]]).#%)]",
|
|
2742
|
+
"# [“Denum(1,[21])”, “Denum(4,[6, 0, 0, 0])”, “Denum(2,[4, 0])”, “Denum(3,[0, 0, 0])”, “Denum(2,[5, 3])”]",
|
|
2804
2743
|
"```",
|
|
2805
2744
|
"It keeps the Count, the total Size and nonnegative loads, its arity is the",
|
|
2806
2745
|
"Count, it is idempotent, and its answer is an instance of this same class, so",
|
|
@@ -2810,21 +2749,21 @@ export const HC_SOURCES = new Map([
|
|
|
2810
2749
|
"; [Bn.#, Bn.##, Bd.##, Bn.loads.#, (Bn.#%) = Bn, Bn.#### = Bn, “” Bd]",
|
|
2811
2750
|
"# [3, 21, 21, 3, <>, <>, “Denum(3,[2, 5, 3, 7, 4])”]",
|
|
2812
2751
|
"; .lawB {.k _; .n (k.#%); [n.# = k.#, n.## = k.##, n.loads.# = k.#, (n.#%) = n]};",
|
|
2813
|
-
"; [Denum [1, [4, 4]], Denum [2, [1, 2, 3]], Denum [5, [9]], Denum [4, [1, 2, 3, 4, 5, 6, 7, 8, 9]], Denum [3, 123456789012345678901234567890, 1]] &| lawB",
|
|
2752
|
+
"; [Denum [1, [4, 4]], Denum [2, [1, 2, 3]], Denum [5, [9]], Denum [4, [1, 2, 3, 4, 5, 6, 7, 8, 9]], Denum [3, [123456789012345678901234567890, 1]]] &| lawB",
|
|
2814
2753
|
"# [<>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>]",
|
|
2815
2754
|
"```",
|
|
2816
2755
|
"Order matters. The same loads in another order can bind differently, so",
|
|
2817
2756
|
"binding is neither permutation-invariant nor invertible",
|
|
2818
2757
|
"```",
|
|
2819
2758
|
"; [“” ((Denum [2, [1, 2, 3]]).#%), “” ((Denum [2, [3, 2, 1]]).#%), “” ((Denum [2, [2, 1, 3]]).#%), (Denum [2, [3, 1]]).#% = (Denum [2, [1, 3]]).#%]",
|
|
2820
|
-
"# [“Denum(2,4,2)”, “Denum(2,4,2)”, “Denum(2,5,1)”, ()]",
|
|
2759
|
+
"# [“Denum(2,[4, 2])”, “Denum(2,[4, 2])”, “Denum(2,[5, 1])”, ()]",
|
|
2821
2760
|
"```",
|
|
2822
2761
|
"Binding follows application: a Denum whose Count has grown past its arity binds",
|
|
2823
2762
|
"into as many loads as it has seen",
|
|
2824
2763
|
"```",
|
|
2825
2764
|
"; .G3 ((((Denum [0, [0, 0]]) 2) 5) 3);",
|
|
2826
2765
|
"; [“” G3, “” (G3.#%)]",
|
|
2827
|
-
"# [“Denum(3,5,5)”, “Denum(3,[5, 5, 0])”]",
|
|
2766
|
+
"# [“Denum(3,[5, 5])”, “Denum(3,[5, 5, 0])”]",
|
|
2828
2767
|
"```",
|
|
2829
2768
|
"A Denum of Count zero is present, under `.####` too, but has no channel to bind",
|
|
2830
2769
|
"into, so `.#%` refuses it with a stable named failure rather than nil, an empty",
|
|
@@ -2845,20 +2784,86 @@ export const HC_SOURCES = new Map([
|
|
|
2845
2784
|
"; [Edge.#, (Edge.loads).#, Edge.##, (Edge.loads) .0, (Edge.loads) .1, (Edge.loads) .65535, (Denum [65537, [1, 2]]).#%]",
|
|
2846
2785
|
"# [65536, 65536, 3, 1, 2, 0, $!.denum-binding-capacity]",
|
|
2847
2786
|
"```",
|
|
2848
|
-
"`.#%` is one token. `.#`, `%%` and a comment are read as before
|
|
2849
|
-
"
|
|
2787
|
+
"`.#%` is one token. `.#`, `%%` and a comment are read as before. A name is",
|
|
2788
|
+
"never split, so `.#%%` is one unbound name rather than `.#%` before a `%`: write",
|
|
2789
|
+
"`.# %%` for the modulo",
|
|
2850
2790
|
"```",
|
|
2851
2791
|
"; [[5, 3, 1].# %% 2, (Denum [3, [1]]).# %% 2, (Denum [3, [1]]).#% .#] # a comment after",
|
|
2852
2792
|
"# [1, 1, 3]",
|
|
2853
2793
|
"```",
|
|
2794
|
+
"## Geometric observers, `.##%` … `.###%%%`",
|
|
2795
|
+
"Six observers read a Denum through a geometry (occurrence/figure 007.41b,",
|
|
2796
|
+
"007.41c). Each first binds the Denum with `.#%`, so all of them read the same",
|
|
2797
|
+
"C loads `B = [b0, …, b(C−1)]`, and every refusal of `.#%` is theirs too. The",
|
|
2798
|
+
"`##` spelling answers a squared magnitude, exact and nonnegative: a Count when",
|
|
2799
|
+
"whole and a rational otherwise. The `###` spelling answers a fresh list of",
|
|
2800
|
+
"signed coordinates, never a Denum and never a single number. They are",
|
|
2801
|
+
"observations only: no load, native observer or operator changes, and no",
|
|
2802
|
+
"algebra product is installed",
|
|
2803
|
+
"",
|
|
2804
|
+
"The centered simplex, `%`, places the C loads on the vertices of a regular",
|
|
2805
|
+
"simplex centred at zero. `.##%` is `(C·Σbi² − S²)/(C−1)` with `S = Σbi`, and",
|
|
2806
|
+
"`.###%` is the centred coefficients `bi − S/C`, which sum to zero; their",
|
|
2807
|
+
"numerators over C are `C·bi − S`. Adding the same amount to every load",
|
|
2808
|
+
"changes neither, and Count 1 is the degenerate simplex, of magnitude 0",
|
|
2809
|
+
"```",
|
|
2810
|
+
"; .Sd (Denum [3, [2, 5, 3, 7, 4]]);",
|
|
2811
|
+
"; [Sd.##%, Sd.###%, (Sd.#%).##% = Sd.##%, “” Sd]",
|
|
2812
|
+
"# [36, [2, 2, -4], <>, “Denum(3,[2, 5, 3, 7, 4])”]",
|
|
2813
|
+
"; [(Denum [2, [3, 1]]).##%, (Denum [4, [2, 4, 2, 4]]).##%, (Denum [3, [1]]).###%, (Denum [3, [4, 4, 4]]).##%, (Denum [1, [5, 3]]).###%]",
|
|
2814
|
+
"# [4, 16/3, [2/3, -1/3, -1/3], 0, [0]]",
|
|
2815
|
+
"```",
|
|
2816
|
+
"The Cayley–Dickson observers, `%%`, need a Count that is a power of two, the",
|
|
2817
|
+
"dimension of a Cayley–Dickson algebra; any other Count is",
|
|
2818
|
+
"`$!.denum-cd-count`. They map the simplex coordinates isometrically onto the",
|
|
2819
|
+
"C−1 imaginary units with the fixed-sign Helmert basis of the 007.41",
|
|
2820
|
+
"experiment: `.###%%` is `[0, x1, …, x(C−1)]` with",
|
|
2821
|
+
"`xk = √(C/(C−1))·(b0 + … + b(k−1) − k·bk)/√(k(k+1))`, and `.##%%` is",
|
|
2822
|
+
"`Σ xk²`. Each `xk²` is rational, so `.##%%` is exact and equals `.##%`. A",
|
|
2823
|
+
"coordinate is exact when it is rational and a double where it has a radical.",
|
|
2824
|
+
"Equal magnitudes do not make the products agree: at C = 2, `B = [3, 1]` maps to",
|
|
2825
|
+
"`x = [0, 2]`, whose Cayley–Dickson square is −4, while the simplex magnitude is",
|
|
2826
|
+
"+4",
|
|
2827
|
+
"```",
|
|
2828
|
+
"; [(Denum [2, [3, 1]]).###%%, (Denum [2, [3, 1]]).##%%, (Denum [4, [2, 4, 2, 7]]).##%% = (Denum [4, [2, 4, 2, 7]]).##%, ((Denum [4, [2, 4, 2, 7]]).###%%) .3]",
|
|
2829
|
+
"# [[0, 2], 4, <>, -13/3]",
|
|
2830
|
+
"; [(Denum [3, [1]]).##%%, (Denum [6, [1]]).###%%, (Denum [1, [5]]).###%%]",
|
|
2831
|
+
"# [$!.denum-cd-count, $!.denum-cd-count, [0]]",
|
|
2832
|
+
"```",
|
|
2833
|
+
"The cross-polytope observers, `%%%`, place one load on each vertex of a",
|
|
2834
|
+
"cross-polytope, `C = 2n` vertices `+e0 … +e(n−1), −e0 … −e(n−1)`, so `bi` and",
|
|
2835
|
+
"`b(i+n)` are opposite. `.###%%%` is the antipodal residual `ri = bi − b(i+n)`",
|
|
2836
|
+
"and `.##%%%` is `Σ ri²`, zero exactly when every opposite pair matches. An odd",
|
|
2837
|
+
"Count has no such pairing and is `$!.denum-cross-count`; that refuses only this",
|
|
2838
|
+
"one-load-per-vertex binding, since a cross-polytope exists in every dimension n",
|
|
2839
|
+
"```",
|
|
2840
|
+
"; [(Denum [4, [2, 4, 2, 4]]).###%%%, (Denum [4, [2, 4, 2, 4]]).##%%%, (Denum [6, [5, 2, 3, 5, 1, 3]]).###%%%, (Denum [6, [5, 2, 3, 5, 1, 3]]).##%%%, (Denum [2, [3, 1]]).###%%%]",
|
|
2841
|
+
"# [[0, 0], 0, [0, 1, 0], 1, [2]]",
|
|
2842
|
+
"; [(Denum [3, [1]]).##%%%, (Denum [1, [1]]).###%%%]",
|
|
2843
|
+
"# [$!.denum-cross-count, $!.denum-cross-count]",
|
|
2844
|
+
"```",
|
|
2845
|
+
"Only a Denum is observed, as `.#%` binds only a Denum, and no class can declare",
|
|
2846
|
+
"an observer of its own",
|
|
2847
|
+
"```",
|
|
2848
|
+
"; [[5, 3].##%, 3.###%%, (Denum [0, [1]]).##%%%, (Denum [70000, [1]]).###%, [.##% {7}].##%]",
|
|
2849
|
+
"# [$!.denum-binding-receiver, $!.denum-binding-receiver, $!.denum-binding-zero-count, $!.denum-binding-capacity, $!.denum-binding-receiver]",
|
|
2850
|
+
"```",
|
|
2851
|
+
"Each observer is one token. A longer run, such as `.##%%%%`, is one unbound",
|
|
2852
|
+
"name, never an observer before a `%`.",
|
|
2853
|
+
"**Breaking:** `.##%%` and `.###%%` written without a space used to read as",
|
|
2854
|
+
"`.##` or `.###` before `%%`; write `.## %%` for the modulo",
|
|
2855
|
+
"```",
|
|
2856
|
+
"; [[5, 3, 1].## %% 2, [5, 3, 1].### %% 2, (Denum [2, [3, 1]]).##%.#]",
|
|
2857
|
+
"# [1, 1, 4]",
|
|
2858
|
+
"```",
|
|
2854
2859
|
"## Importing",
|
|
2855
2860
|
"",
|
|
2856
2861
|
"Imported, the file binds the same class. The import is an example line, so",
|
|
2857
2862
|
"the evaluator, which reads this file without a root, never runs it",
|
|
2858
2863
|
"```",
|
|
2859
2864
|
"; Denums <- './hc/denum.hc';",
|
|
2860
|
-
"; [(Denums.Denum [2, 5, 3]) = [5, 3].####, “” ((Denums.Denum [0, 0, 0]) 4)]",
|
|
2861
|
-
"# [<>, “Denum(1,4,0)”]",
|
|
2865
|
+
"; [(Denums.Denum [2, [5, 3]]) = [5, 3].####, “” ((Denums.Denum [0, [0, 0]]) 4)]",
|
|
2866
|
+
"# [<>, “Denum(1,[4, 0])”]",
|
|
2862
2867
|
"",
|
|
2863
2868
|
].join("\n"),
|
|
2864
2869
|
],
|
|
@@ -2933,13 +2938,13 @@ export const HC_SOURCES = new Map([
|
|
|
2933
2938
|
"; [([A, A, A] ./ 2).channels, ([A, A, A] ./ 2).channels &| {_} &| {[_ === A]}]",
|
|
2934
2939
|
"# [[[[1, [2]], [1, [2]]], [[1, [2]]]], [<>, <>, <>]]",
|
|
2935
2940
|
"```",
|
|
2936
|
-
"Two channels are
|
|
2941
|
+
"Two channels are a router like any other. One",
|
|
2937
2942
|
"channel is the whole list, and more channels than elements leave the last ones",
|
|
2938
2943
|
"empty. An empty list deals into n empty channels; empty elements are dealt",
|
|
2939
2944
|
"like any other",
|
|
2940
2945
|
"```",
|
|
2941
|
-
"; [“” ([1, 2, 3] ./ 2), ([1, 2, 3] ./ 2).
|
|
2942
|
-
"# [“RotorRouter([1, 3],[2])”, [1, 3], 1]",
|
|
2946
|
+
"; [“” ([1, 2, 3] ./ 2), (([1, 2, 3] ./ 2).channels .0), (([1, 2, 3] ./ 2).# %% 2)]",
|
|
2947
|
+
"# [“RotorRouter([[1, 3], [2]])”, [1, 3], 1]",
|
|
2943
2948
|
"; [(xs ./ 1).channels, ([1, 2] ./ 5).channels, ([] ./ 3).channels, ([[], []] ./ 2).channels]",
|
|
2944
2949
|
"# [[[[1, [2]], “b”, { 5 + 3 }, [.k 9; 4], 5, (6, 7), 7]], [[1], [2], [], [], []], [[], [], []], [[[]], [[]]]]",
|
|
2945
2950
|
"```",
|
|
@@ -2964,7 +2969,7 @@ export const HC_SOURCES = new Map([
|
|
|
2964
2969
|
"```",
|
|
2965
2970
|
"; .X [A, 2, 3, 4, 5, 6];",
|
|
2966
2971
|
"; [“” (X ./ 2), “” ((X ./ 2) ./ 2), ((X ./ 2) ./ 2) = (X ./ 2), ((X ./ 2) ./ 3) = (X ./ 3), ((X ./ 3) ./ 2) = (X ./ 2)]",
|
|
2967
|
-
"# [“RotorRouter([[1, [2]], 3, 5],[2, 4, 6])”, “RotorRouter([[1, [2]], 3, 5],[2, 4, 6])”, <>, <>, <>]",
|
|
2972
|
+
"# [“RotorRouter([[[1, [2]], 3, 5], [2, 4, 6]])”, “RotorRouter([[[1, [2]], 3, 5], [2, 4, 6]])”, <>, <>, <>]",
|
|
2968
2973
|
"; [((X ./ 2) ./ 3).channels, (((X ./ 2) ./ 3).channels .0 .0) === A]",
|
|
2969
2974
|
"# [[[[1, [2]], 4], [2, 5], [3, 6]], <>]",
|
|
2970
2975
|
"```",
|
|
@@ -2972,8 +2977,8 @@ export const HC_SOURCES = new Map([
|
|
|
2972
2977
|
"two whole Frames, dealt as such, even when they look like channels",
|
|
2973
2978
|
"```",
|
|
2974
2979
|
"; .N [[1, 3, 5], [2, 4, 6]];",
|
|
2975
|
-
"; [“” (N ./ 2), (N ./ 2).
|
|
2976
|
-
"# [“RotorRouter([[1, 3, 5]],[[2, 4, 6]])”, <>, 2, “RotorRouter([[1, 3, 5]],[[2, 4, 6]])”]",
|
|
2980
|
+
"; [“” (N ./ 2), ((N ./ 2).channels .0) .0 = [1, 3, 5], (N ./ 2).# , “” ((N ./ 2) ./ 2)]",
|
|
2981
|
+
"# [“RotorRouter([[[1, 3, 5]], [[2, 4, 6]]])”, <>, 2, “RotorRouter([[[1, 3, 5]], [[2, 4, 6]]])”]",
|
|
2977
2982
|
"```",
|
|
2978
2983
|
"Uneven channels read back in dealt order: seven Frames into three channels,",
|
|
2979
2984
|
"then into one, give the seven in order; into two they are dealt again from",
|
|
@@ -2981,7 +2986,7 @@ export const HC_SOURCES = new Map([
|
|
|
2981
2986
|
"```",
|
|
2982
2987
|
"; .Y [1, 2, 3, 4, 5, 6, 7];",
|
|
2983
2988
|
"; [“” (Y ./ 3), (((Y ./ 3) ./ 1).channels .0) = Y, “” ((Y ./ 3) ./ 2), ((Y ./ 3) ./ 2) = (Y ./ 2)]",
|
|
2984
|
-
"# [“RotorRouter([[1, 4, 7], [2, 5], [3, 6]])”, <>, “RotorRouter([1, 3, 5, 7],[2, 4, 6])”, <>]",
|
|
2989
|
+
"# [“RotorRouter([[1, 4, 7], [2, 5], [3, 6]])”, <>, “RotorRouter([[1, 3, 5, 7], [2, 4, 6]])”, <>]",
|
|
2985
2990
|
"```",
|
|
2986
2991
|
"Channels that no round-robin history left have no dealt order to read, so no",
|
|
2987
2992
|
"router holds them and they are not divided: the constructor refuses them, and",
|
|
@@ -3042,27 +3047,26 @@ export const HC_SOURCES = new Map([
|
|
|
3042
3047
|
"## Denum",
|
|
3043
3048
|
"",
|
|
3044
3049
|
"A Denum of any arity is `Denum [C, loads]`, a Count and a nonempty list of",
|
|
3045
|
-
"Counts.
|
|
3046
|
-
"
|
|
3047
|
-
"Denum, which reads as `Denum(C,[…])`. Every Denum stores `count` and `loads`",
|
|
3050
|
+
"Counts. Every arity is the same class and reads as `Denum(C,[…])`.",
|
|
3051
|
+
"Every Denum stores `count` and `loads`",
|
|
3048
3052
|
"```",
|
|
3049
3053
|
"; Denums <- './hc/denum.hc';",
|
|
3050
3054
|
"; .Denum Denums.Denum;",
|
|
3051
|
-
"; [“” (Denum [3, [5, 2]]), (Denum [3, [5, 2]]) == (Denum [3, 5, 2]), (Denum [3, [5, 2]]).
|
|
3052
|
-
"# [“Denum(3,5,2)”, <>, 5, [5, 2]]",
|
|
3055
|
+
"; [“” (Denum [3, [5, 2]]), (Denum [3, [5, 2]]) == (Denum [3, [5, 2]]), (Denum [3, [5, 2]]).loads .0, (Denum [3, [5, 2]]).loads]",
|
|
3056
|
+
"# [“Denum(3,[5, 2])”, <>, 5, [5, 2]]",
|
|
3053
3057
|
"; [“” (Denum [0, [0, 0, 0]]), “” (Denum [4, [7]]), “” (Denum [2, [1, 2, 3, 4]]), (Denum [2, [1, 2, 3]]).loads, (Denum [2, [1, 2, 3]]).count]",
|
|
3054
3058
|
"# [“Denum(0,[0, 0, 0])”, “Denum(4,[7])”, “Denum(2,[1, 2, 3, 4])”, [1, 2, 3], 2]",
|
|
3055
3059
|
"```",
|
|
3056
3060
|
"No channels, a load that is not a Count, and any other shape are refused",
|
|
3057
3061
|
"```",
|
|
3058
|
-
"; [Denum [2, []], Denum [2, [1, (0 - 1), 3]], Denum [2, [1, 1.5]], Denum [2, [1, [2]]], Denum [(0 - 2), [1]], Denum [2, 5], Denum [2, [1], 3], Denum [2, [1, 2], 3, 4]]",
|
|
3062
|
+
"; [Denum [2, []], Denum [2, [1, (0 - 1), 3]], Denum [2, [1, 1.5]], Denum [2, [1, [2]]], Denum [(0 - 2), [1]], Denum [2, 5], Denum [2, [[1], 3]], Denum [2, [1, 2], 3, 4]]",
|
|
3059
3063
|
"# [$!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum]",
|
|
3060
3064
|
"```",
|
|
3061
|
-
"A
|
|
3065
|
+
"A Denum observes as its loads do: its Count is C, its Size the sum of",
|
|
3062
3066
|
"its loads, and its residual their alternating sum, `e0 − e1 + e2 − …`, the",
|
|
3063
3067
|
"list residual, which for two loads is `L − R`",
|
|
3064
3068
|
"```",
|
|
3065
|
-
"; .d7 (Denum [3, 5, 2]); .q3 (d7 ./ 3);",
|
|
3069
|
+
"; .d7 (Denum [3, [5, 2]]); .q3 (d7 ./ 3);",
|
|
3066
3070
|
"; [q3.#, q3.##, q3.###, q3.count, q3.loads]",
|
|
3067
3071
|
"# [3, 7, 3, 3, [3, 2, 2]]",
|
|
3068
3072
|
"```",
|
|
@@ -3074,30 +3078,30 @@ export const HC_SOURCES = new Map([
|
|
|
3074
3078
|
"the last are empty",
|
|
3075
3079
|
"```",
|
|
3076
3080
|
"; [“” (d7 ./ 2), “” (d7 ./ 3), “” (d7 ./ 4), “” (d7 ./ 1), “” (d7 ./ 9)]",
|
|
3077
|
-
"# [“Denum(3,4,3)”, “Denum(3,[3, 2, 2])”, “Denum(3,[2, 2, 2, 1])”, “Denum(3,[7])”, “Denum(3,[1, 1, 1, 1, 1, 1, 1, 0, 0])”]",
|
|
3081
|
+
"# [“Denum(3,[4, 3])”, “Denum(3,[3, 2, 2])”, “Denum(3,[2, 2, 2, 1])”, “Denum(3,[7])”, “Denum(3,[1, 1, 1, 1, 1, 1, 1, 0, 0])”]",
|
|
3078
3082
|
"```",
|
|
3079
3083
|
"`Denum(3,[5,2]) ./ 3` is `Denum(3,[3,2,2])`, and so is the different state",
|
|
3080
3084
|
"`Denum(3,[4,3]) ./ 3`. Normalization is many-to-one: equal Count and Size give",
|
|
3081
3085
|
"the same result, and the original distribution cannot be recovered",
|
|
3082
3086
|
"```",
|
|
3083
|
-
"; [q3 = (Denum [3, [3, 2, 2]]), ((Denum [3, 4, 3]) ./ 3) = q3, (Denum [3, 4, 3]) = d7, (d7 / 3) = q3, q3 = d7]",
|
|
3087
|
+
"; [q3 = (Denum [3, [3, 2, 2]]), ((Denum [3, [4, 3]]) ./ 3) = q3, (Denum [3, [4, 3]]) = d7, (d7 / 3) = q3, q3 = d7]",
|
|
3084
3088
|
"# [<>, <>, (), <>, ()]",
|
|
3085
3089
|
"```",
|
|
3086
3090
|
"It is idempotent, and dividing again renormalizes from the same Count and Size,",
|
|
3087
3091
|
"so the earlier division leaves no trace",
|
|
3088
3092
|
"```",
|
|
3089
3093
|
"; [(q3 ./ 3) = q3, (q3 ./ 2) = (d7 ./ 2), ((d7 ./ 4) ./ 3) = q3, “” (q3 ./ 2), ((q3 ./ 2) ./ 3) = q3]",
|
|
3090
|
-
"# [<>, <>, <>, “Denum(3,4,3)”, <>]",
|
|
3094
|
+
"# [<>, <>, <>, “Denum(3,[4, 3])”, <>]",
|
|
3091
3095
|
"```",
|
|
3092
3096
|
"Zero Size, zero Count, one channel, and more channels than Size or Count",
|
|
3093
3097
|
"```",
|
|
3094
|
-
"; [“” ((Denum [0, 0, 0]) ./ 3), “” ((Denum [0, 9, 0]) ./ 4), “” ((Denum [0, 9, 0]) ./ 1), “” ((Denum [2, 1, 1]) ./ 5), “” ((Denum [1, 0, 0]) ./ 2)]",
|
|
3095
|
-
"# [“Denum(0,[0, 0, 0])”, “Denum(0,[3, 2, 2, 2])”, “Denum(0,[9])”, “Denum(2,[1, 1, 0, 0, 0])”, “Denum(1,0,0)”]",
|
|
3098
|
+
"; [“” ((Denum [0, [0, 0]]) ./ 3), “” ((Denum [0, [9, 0]]) ./ 4), “” ((Denum [0, [9, 0]]) ./ 1), “” ((Denum [2, [1, 1]]) ./ 5), “” ((Denum [1, [0, 0]]) ./ 2)]",
|
|
3099
|
+
"# [“Denum(0,[0, 0, 0])”, “Denum(0,[3, 2, 2, 2])”, “Denum(0,[9])”, “Denum(2,[1, 1, 0, 0, 0])”, “Denum(1,[0, 0])”]",
|
|
3096
3100
|
"```",
|
|
3097
3101
|
"The divisor is a channel Count, refused as a list refuses it, never coerced to",
|
|
3098
3102
|
"its Size",
|
|
3099
3103
|
"```",
|
|
3100
|
-
"; [d7 ./ 0, d7 ./ (3 - 1), d7 ./ 1.5, d7 ./ (1 / 2), d7 ./ [3], d7 ./ “three”, d7 ./ (Denum [1, 1, 1])]",
|
|
3104
|
+
"; [d7 ./ 0, d7 ./ (3 - 1), d7 ./ 1.5, d7 ./ (1 / 2), d7 ./ [3], d7 ./ “three”, d7 ./ (Denum [1, [1, 1]])]",
|
|
3101
3105
|
"# [$!.division-by-zero /, $!.division-domain /, $!.division-domain /, $!.division-domain /, $!.division-domain /, $!.division-domain /, $!.division-domain /]",
|
|
3102
3106
|
"```",
|
|
3103
3107
|
"## Applying after division",
|
|
@@ -3112,7 +3116,7 @@ export const HC_SOURCES = new Map([
|
|
|
3112
3116
|
"# [“Denum(1,[4, 0, 0])”, “Denum(2,[4, 0, 0])”, “Denum(3,[4, 0, 6])”]",
|
|
3113
3117
|
"```",
|
|
3114
3118
|
"A reduce applies it the same way, and through a mutable name it writes in",
|
|
3115
|
-
"place. One channel takes every deposit, and two channels
|
|
3119
|
+
"place. One channel takes every deposit, and two channels alternate by the Count's",
|
|
3116
3120
|
"parity",
|
|
3117
3121
|
"```",
|
|
3118
3122
|
"; “” ([5, 2, 7, 1, 0] | (Denum [0, [0, 0, 0]]))",
|
|
@@ -3121,7 +3125,7 @@ export const HC_SOURCES = new Map([
|
|
|
3121
3125
|
"; m_ 5;",
|
|
3122
3126
|
"; m_ 6;",
|
|
3123
3127
|
"; [“” m_, “” ((d7 ./ 1) 4), “” ((d7 ./ 2) 4), “” (d7 4)]",
|
|
3124
|
-
"# [“Denum(2,[5, 6, 0])”, “Denum(4,[11])”, “Denum(4,4,7)”, “Denum(4,5,6)”]",
|
|
3128
|
+
"# [“Denum(2,[5, 6, 0])”, “Denum(4,[11])”, “Denum(4,[4, 7])”, “Denum(4,[5, 6])”]",
|
|
3125
3129
|
"```",
|
|
3126
3130
|
"## Denum laws",
|
|
3127
3131
|
"",
|
|
@@ -3131,23 +3135,23 @@ export const HC_SOURCES = new Map([
|
|
|
3131
3135
|
"m from 1 to 4 dividing by n then m is dividing by m",
|
|
3132
3136
|
"```",
|
|
3133
3137
|
"; .cs [0, 1, 2, 3]; .ls [0, 1, 2, 3, 4]; .ns [1, 2, 3, 4];",
|
|
3134
|
-
"; .states (cs &| {.c _; ls &| {.l _; ls & {Denum [c, l, _]}}});",
|
|
3138
|
+
"; .states (cs &| {.c _; ls &| {.l _; ls & {Denum [c, [l, _]]}}});",
|
|
3135
3139
|
"; .law {.k _; ns &| {.n _; .q (k ./ n); [q.# = k.#, q.## = k.##, q.loads.# = n, q.loads = (((k.## [1]) ./ n).channels & {_.#}), (q ./ n) = q]}};",
|
|
3136
3140
|
"; .renorm {.k _; ns &| {.n _; ns & {.m _; ((k ./ n) ./ m) = (k ./ m)}}};",
|
|
3137
3141
|
"; .checks ((states &| law) | (states &| renorm));",
|
|
3138
3142
|
"; [states.#, checks.#, checks = (checks & {<>})]",
|
|
3139
3143
|
"# [100, 3600, <>]",
|
|
3140
3144
|
"```",
|
|
3141
|
-
"##
|
|
3145
|
+
"## Denum operations",
|
|
3142
3146
|
"",
|
|
3143
|
-
"Its fourth hash is intrinsic
|
|
3144
|
-
"
|
|
3145
|
-
"
|
|
3147
|
+
"Its fourth hash is intrinsic for every arity: a fresh equal Denum of the same",
|
|
3148
|
+
"arity, Count zero included. A record that only spells the fields is not one, and",
|
|
3149
|
+
"forged observers give the ordinary derived Denum of two loads",
|
|
3146
3150
|
"```",
|
|
3147
3151
|
"; [(q3.####) == q3, (q3.####) === q3, ((Denum [0, [0, 0, 0]]).####) = (Denum [0, [0, 0, 0]]), ([5, 2].#### ./ 3) = (Denum [2, [3, 2, 2]])]",
|
|
3148
3152
|
"# [<>, (), <>, <>]",
|
|
3149
3153
|
"; [[.count 3; .loads [3, 2, 2]].####, “” ([.count 3; .loads [3, 2, 2]; .# {3}; .## {7}; .### {3}].####)]",
|
|
3150
|
-
"# [(), “Denum(3,5,2)”]",
|
|
3154
|
+
"# [(), “Denum(3,[5, 2])”]",
|
|
3151
3155
|
"```",
|
|
3152
3156
|
"`*` and `scale_` scale every load and keep the Count; the ratios read Size and",
|
|
3153
3157
|
"residual over the Count, nil at Count zero",
|
|
@@ -3158,28 +3162,27 @@ export const HC_SOURCES = new Map([
|
|
|
3158
3162
|
"`+` and `-` follow the residual's signs. The residual adds the loads at even",
|
|
3159
3163
|
"indices and subtracts those at odd ones, so `-` deposits `x.##` on the first",
|
|
3160
3164
|
"even load, load 0, and raises the residual, and `+` deposits on the first odd",
|
|
3161
|
-
"load, load 1, and lowers it.
|
|
3162
|
-
"
|
|
3163
|
-
"by the operand's Size. One load has no odd index, so there `+` is",
|
|
3165
|
+
"load, load 1, and lowers it. Both keep the Count, and both are `deposit_ [0, x.##]` and",
|
|
3166
|
+
"`deposit_ [1, x.##]`. One load has no odd index, so there `+` is",
|
|
3164
3167
|
"`$!!.invalid-arity`",
|
|
3165
3168
|
"```",
|
|
3166
3169
|
"; [“” (q3 + 1), “” (q3 - 1), q3.###, (q3 + 1).###, (q3 - 1).###, (q3 + 1).#]",
|
|
3167
3170
|
"# [“Denum(3,[3, 3, 2])”, “Denum(3,[4, 2, 2])”, 3, 2, 4, 3]",
|
|
3168
3171
|
"; [“” ((d7 ./ 4) + 1), “” ((d7 ./ 4) - 2.5), (d7 ./ 1) + 1, “” ((d7 ./ 1) - 1), “” (d7 + 1), “” (d7 - 1)]",
|
|
3169
|
-
"# [“Denum(3,[2, 3, 2, 1])”, “Denum(3,[4, 2, 2, 1])”, $!!.invalid-arity, “Denum(3,[8])”, “Denum(3,5,3)”, “Denum(3,6,2)”]",
|
|
3170
|
-
"; [((q3 + 4) - 2) = ((q3 - 2) + 4), ((q3 + 1) ./ 3) = ((q3 - 1) ./ 3), q3 + ([].nope), q3.
|
|
3172
|
+
"# [“Denum(3,[2, 3, 2, 1])”, “Denum(3,[4, 2, 2, 1])”, $!!.invalid-arity, “Denum(3,[8])”, “Denum(3,[5, 3])”, “Denum(3,[6, 2])”]",
|
|
3173
|
+
"; [((q3 + 4) - 2) = ((q3 - 2) + 4), ((q3 + 1) ./ 3) = ((q3 - 1) ./ 3), q3 + ([].nope), q3.deposit_ [1, (0 - 1)], q3.deposit_ [0, 1.5], “” q3]",
|
|
3171
3174
|
"# [<>, <>, $!.name-missing “..., $!!.invalid-denum, $!!.invalid-denum, “Denum(3,[3, 2, 2])”]",
|
|
3172
3175
|
"```",
|
|
3173
3176
|
"## RotorRouter",
|
|
3174
3177
|
"",
|
|
3175
|
-
"`RotorRouter [ch0, …, chk−1]` takes k ≥ 1 channel arrays
|
|
3176
|
-
"
|
|
3178
|
+
"`RotorRouter [ch0, …, chk−1]` takes k ≥ 1 channel arrays, and every router, of",
|
|
3179
|
+
"any number of channels, is the same class and stores `channels`.",
|
|
3177
3180
|
"A round-robin history from channel 0 fills the channels so that the first",
|
|
3178
3181
|
"C mod k hold one more than the rest, so the constructor admits exactly the",
|
|
3179
3182
|
"channels whose Counts are the dealing of C into k, and refuses every other",
|
|
3180
3183
|
"```",
|
|
3181
3184
|
"; [[[]], [[], []], [[], [], []], [[], [], [], []]] & {“” (RotorRouter _)}",
|
|
3182
|
-
"# [“RotorRouter([[]])”, “RotorRouter([],[])”, “RotorRouter([[], [], []])”, “RotorRouter([[], [], [], []])”]",
|
|
3185
|
+
"# [“RotorRouter([[]])”, “RotorRouter([[], []])”, “RotorRouter([[], [], []])”, “RotorRouter([[], [], [], []])”]",
|
|
3183
3186
|
"; [[[5]], [[5], [6]], [[5], [], []], [[5], [6], []], [[5, 8], [6], [7]], [[5, 9], [6], [7], [8]]] & {(RotorRouter _).#}",
|
|
3184
3187
|
"# [1, 2, 1, 2, 4, 5]",
|
|
3185
3188
|
"; [RotorRouter [[1], [2], [3, 4]], RotorRouter [[1], [], [2]], RotorRouter [[1, 2, 3], [4], [5]], RotorRouter [[], [1]], RotorRouter [[1, 2], [3], [4], [5], [6, 7]], RotorRouter []]",
|
|
@@ -3209,15 +3212,15 @@ export const HC_SOURCES = new Map([
|
|
|
3209
3212
|
"# [[<>, (), ()], [<>, ()], 9, <>]",
|
|
3210
3213
|
"```",
|
|
3211
3214
|
"Division is idempotent and renormalizes: dividing again re-deals the same",
|
|
3212
|
-
"history, so a router divided by 3 and then 2 is the
|
|
3215
|
+
"history, so a router divided by 3 and then 2 is the two-channel router it came",
|
|
3213
3216
|
"from. The empty router divides into empty channels",
|
|
3214
3217
|
"```",
|
|
3215
3218
|
"; [(t3 ./ 3) = t3, (t3 ./ 2) = r7, ((r7 ./ 4) ./ 3) = t3, ((t3 ./ 4) ./ 2) = r7, “” (r0 ./ 3), (r0 ./ 3).#, ((RotorRouter [[], [], []]) ./ 2) = r0]",
|
|
3216
3219
|
"# [<>, <>, <>, <>, “RotorRouter([[], [], []])”, 0, <>]",
|
|
3217
3220
|
"```",
|
|
3218
3221
|
"After division the next route goes to channel C mod n: `t3` has Count 7, so 8,",
|
|
3219
|
-
"9 and 10 go to channels 1, 2 and 0. Divided back into two, it is the
|
|
3220
|
-
"router that routed the same Frames",
|
|
3222
|
+
"9 and 10 go to channels 1, 2 and 0. Divided back into two, it is the",
|
|
3223
|
+
"two-channel router that routed the same Frames",
|
|
3221
3224
|
"```",
|
|
3222
3225
|
"; [“” (t3 8), “” ((t3 8) 9), “” (((t3 8) 9) 10)]",
|
|
3223
3226
|
"# [“RotorRouter([[[1, [2]], [.k 9; 4], 7], [“b”, 5, 8], [{ 5 + 3 }, (6, 7)]])”, “RotorRouter([[[1, [2]], [.k 9; 4], 7], [“b”, 5, 8], [{ 5 + 3 }, (6, 7), 9]])”, “RotorRouter([[[1, [2]], [.k 9; 4], 7, 10], [“b”, 5, 8], [{ 5 + 3 }, (6, 7), 9]])”]",
|
|
@@ -3262,23 +3265,22 @@ export const HC_SOURCES = new Map([
|
|
|
3262
3265
|
"```",
|
|
3263
3266
|
"The divisor is refused as for a list",
|
|
3264
3267
|
"```",
|
|
3265
|
-
"; [r7 ./ 0, r7 ./ (3 - 1), r7 ./ 1.5, r7 ./ [2], r7 ./ (Denum [1, 1, 1]), r7 ./ “two”]",
|
|
3268
|
+
"; [r7 ./ 0, r7 ./ (3 - 1), r7 ./ 1.5, r7 ./ [2], r7 ./ (Denum [1, [1, 1]]), r7 ./ “two”]",
|
|
3266
3269
|
"# [$!.division-by-zero /, $!.division-domain /, $!.division-domain /, $!.division-domain /, $!.division-domain /, $!.division-domain /]",
|
|
3267
3270
|
"```",
|
|
3268
3271
|
"## A router's observers and fourth hash",
|
|
3269
3272
|
"",
|
|
3270
3273
|
"A router of any arity declares its Count C, its Size, the sum of its channel",
|
|
3271
|
-
"loads, and its residual, their alternating sum, as
|
|
3272
|
-
"fourth hash is the Denum of the same arity: a router of k channels
|
|
3273
|
-
"
|
|
3274
|
+
"loads, and its residual, their alternating sum, as its Denum does. Its",
|
|
3275
|
+
"fourth hash is the Denum of the same arity: a router of k channels is",
|
|
3276
|
+
"recognized intrinsically, as an instance of the shipped class, and",
|
|
3274
3277
|
"answers `Denum [C, loads]`, one load per channel, so it routes to channel",
|
|
3275
|
-
"C mod k as its Denum deposits there.
|
|
3276
|
-
"it always did. At Count zero there is no Denum, for any arity",
|
|
3278
|
+
"C mod k as its Denum deposits there. At Count zero there is no Denum, for any arity",
|
|
3277
3279
|
"```",
|
|
3278
3280
|
"; [t3.#, t3.##, t3.###, “” t3.####, t3.#### = (Denum [7, [14, 6, 22]]), t3.####.## = t3.##, t3.####.### = t3.###]",
|
|
3279
3281
|
"# [7, 42, 30, “Denum(7,[14, 6, 22])”, <>, <>, <>]",
|
|
3280
3282
|
"; [“” (r7.####), ([] ./ 3).####, (RotorRouter [[], [], []]).####, “” ((([] ./ 3) 5).####)]",
|
|
3281
|
-
"# [“Denum(7,24,18)”, (), (), “Denum(1,[5, 0, 0])”]",
|
|
3283
|
+
"# [“Denum(7,[24, 18])”, (), (), “Denum(1,[5, 0, 0])”]",
|
|
3282
3284
|
"```",
|
|
3283
3285
|
"So the projection law `(r y).#### = r.#### y` holds for every arity: routing y",
|
|
3284
3286
|
"to channel C mod k and observing is depositing `y.##` there",
|
|
@@ -3304,7 +3306,7 @@ export const HC_SOURCES = new Map([
|
|
|
3304
3306
|
"```",
|
|
3305
3307
|
"; .two [5, 2];",
|
|
3306
3308
|
"; [loads (two ./ 2).channels, ((two | r0) ./ 2).channels & {load _}, “” (two.#### ./ 2), ((two | r0) ./ 2).#### = (two.#### ./ 2), ((two | r0) ./ 2).####.## = (two.#### ./ 2).##]",
|
|
3307
|
-
"# [[5, 2], [5, 2], “Denum(2,4,3)”, (), <>]",
|
|
3309
|
+
"# [[5, 2], [5, 2], “Denum(2,[4, 3])”, (), <>]",
|
|
3308
3310
|
"```",
|
|
3309
3311
|
"They agree when every child has Size one, since then each Frame is one Size",
|
|
3310
3312
|
"unit. With other Sizes they need not",
|
|
@@ -3541,17 +3543,17 @@ export const HC_SOURCES = new Map([
|
|
|
3541
3543
|
"including [0].####.",
|
|
3542
3544
|
"```",
|
|
3543
3545
|
"; [[].####, 0.####, “” “hello”.####, <2,3,5>.####]",
|
|
3544
|
-
"# [(), (), “Denum(5,3,2)”, ()]",
|
|
3546
|
+
"# [(), (), “Denum(5,[3, 2])”, ()]",
|
|
3545
3547
|
"; [(10 - 5).#### = 5.####, (0 - 5).#### = 5.####, (5.0).#### = 5.####, “hello”.#### = 5.####]",
|
|
3546
3548
|
"# [<>, <>, <>, <>]",
|
|
3547
3549
|
"; [<>.#, <>.##, <>.###, ().##]",
|
|
3548
3550
|
"# [0, 1, 0, 1]",
|
|
3549
3551
|
"; [1, 2, 3, 7] & {“” _.####}",
|
|
3550
|
-
"# [“Denum(1,1,0)”, “Denum(2,1,1)”, “Denum(3,2,1)”, “Denum(7,4,3)”]",
|
|
3552
|
+
"# [“Denum(1,[1, 0])”, “Denum(2,[1, 1])”, “Denum(3,[2, 1])”, “Denum(7,[4, 3])”]",
|
|
3551
3553
|
"; [[0], [“hello”], [<2,3,5>,2], {5 + 3}] & {“” _.####}",
|
|
3552
|
-
"# [“Denum(1,0,0)”, “Denum(1,5,0)”, “Denum(2,3,2)”, “Denum(3,8,1)”]",
|
|
3554
|
+
"# [“Denum(1,[0, 0])”, “Denum(1,[5, 0])”, “Denum(2,[3, 2])”, “Denum(3,[8, 1])”]",
|
|
3553
3555
|
"; [“” ([[],[]].#### 3), “” (7.####.scale_ 2), ([[],[]] 3).#### = ([[],[]].#### 3)]",
|
|
3554
|
-
"# [“Denum(3,4,1)”, “Denum(7,8,6)”, <>]",
|
|
3556
|
+
"# [“Denum(3,[4, 1])”, “Denum(7,[8, 6])”, <>]",
|
|
3555
3557
|
"```",
|
|
3556
3558
|
"A RotorRouter, the class in `hc/rotor-router.hc` (011.21), keeps the routed",
|
|
3557
3559
|
"Figures themselves in two ordered channels and declares the observers that make",
|
|
@@ -3561,7 +3563,7 @@ export const HC_SOURCES = new Map([
|
|
|
3561
3563
|
"```",
|
|
3562
3564
|
"; Routers <- './hc/rotor-router.hc';",
|
|
3563
3565
|
"; .fr ([[], [[], []], []] | (Routers.RotorRouter [[], []]));",
|
|
3564
|
-
"; [fr.
|
|
3566
|
+
"; [(fr.channels .0), (fr.channels .1), fr.#### = [[], [[], []], []].####]",
|
|
3565
3567
|
"# [[[], []], [[[], []]], <>]",
|
|
3566
3568
|
"",
|
|
3567
3569
|
"```",
|
|
@@ -4187,48 +4189,50 @@ export const HC_SOURCES = new Map([
|
|
|
4187
4189
|
"```",
|
|
4188
4190
|
"RotorRouter (occurrence/figure 011.21)",
|
|
4189
4191
|
"",
|
|
4190
|
-
"A RotorRouter is a
|
|
4191
|
-
"
|
|
4192
|
-
"else. Applying a router to a Frame appends that Frame, the same Frame,
|
|
4193
|
-
"channel
|
|
4194
|
-
"router keeps the children, so its numerical shadow
|
|
4195
|
-
"everything that shadow forgets: which Frames, in
|
|
4192
|
+
"A RotorRouter is a router of k ordered channels, k ≥ 1, that keeps what it",
|
|
4193
|
+
"routes. Its state is the channels, arrays of the Frames routed into them, and",
|
|
4194
|
+
"nothing else. Applying a router to a Frame appends that Frame, the same Frame,",
|
|
4195
|
+
"to channel `C mod k`, where C is the children it holds. A Denum follows the same",
|
|
4196
|
+
"round-robin by Size alone; a router keeps the children, so its numerical shadow",
|
|
4197
|
+
"is a Denum and its state is everything that shadow forgets: which Frames, in",
|
|
4198
|
+
"what order, and which channel. Every number of channels is the same class, with",
|
|
4199
|
+
"the same fields, methods and text; two channels are not a special case.",
|
|
4196
4200
|
"",
|
|
4197
4201
|
"`RotorRouter` is an ordinary HC class, like `Denum` in `hc/denum.hc`: a",
|
|
4198
4202
|
"constructor closure answering a fresh aggregate whose fields are its state and",
|
|
4199
4203
|
"whose methods are the class. Import it with",
|
|
4200
4204
|
"`Routers <- './hc/rotor-router.hc'`, then `Routers.RotorRouter [[], []]`.",
|
|
4201
4205
|
"",
|
|
4202
|
-
"**State (007.25e).** `RotorRouter [
|
|
4203
|
-
"ordered channels.
|
|
4204
|
-
"
|
|
4205
|
-
"
|
|
4206
|
-
"
|
|
4207
|
-
"
|
|
4208
|
-
"
|
|
4209
|
-
"",
|
|
4210
|
-
"**Admissibility.** Routing from empty channels starts
|
|
4211
|
-
"
|
|
4212
|
-
"
|
|
4213
|
-
"
|
|
4214
|
-
"
|
|
4215
|
-
"
|
|
4206
|
+
"**State (007.25e, 007.40).** `RotorRouter [ch0, …, chk−1]` takes k ≥ 1 arrays,",
|
|
4207
|
+
"the ordered channels. A router stores exactly one field, `channels`, so nothing",
|
|
4208
|
+
"can disagree with it. Its Count C is the children it holds, and the next route",
|
|
4209
|
+
"goes to channel `C mod k`. There is no phase argument: earlier versions took",
|
|
4210
|
+
"`RotorRouter [phase, left, right]`, a free phase beside the channels; that form",
|
|
4211
|
+
"is removed, with no alias. Through v0.49.0 the two-channel router was a",
|
|
4212
|
+
"separate builder that also stored `left`, `right` and `phase`.",
|
|
4213
|
+
"",
|
|
4214
|
+
"**Admissibility.** Routing from empty channels starts at channel 0 and deals",
|
|
4215
|
+
"round-robin, so a routed history leaves the first `C mod k` channels one longer",
|
|
4216
|
+
"than the rest, and conversely every such profile is the one history that sent",
|
|
4217
|
+
"`ch0.0`, `ch1.0`, …, `ch0.1`, … in turn. The constructor admits exactly the",
|
|
4218
|
+
"channels whose Counts are the dealing of C children into k,",
|
|
4219
|
+
"`round-robin [C, k]`, and refuses every other with `$!!.invalid-router`, a",
|
|
4220
|
+
"named error, as `Denum` refuses with `$!!.invalid-denum`: with two channels,",
|
|
4216
4221
|
"`RotorRouter [[A], [B, C]]` and `RotorRouter [[A, B], []]` are not histories,",
|
|
4217
4222
|
"and no history or offset is invented for them. Routing keeps the invariant, so",
|
|
4218
4223
|
"every router a program can hold satisfies it. A channel is its elements: an",
|
|
4219
4224
|
"array's properties are configuration, not routed Frames, so the constructor",
|
|
4220
4225
|
"keeps the elements in a fresh array of its own, counts them there, and a",
|
|
4221
4226
|
"channel argument that declares `apply` cannot change what appending means.",
|
|
4222
|
-
"Anything that is not a nonempty list of arrays is refused the same way
|
|
4223
|
-
"
|
|
4224
|
-
"",
|
|
4225
|
-
"
|
|
4226
|
-
"
|
|
4227
|
-
"
|
|
4228
|
-
"it
|
|
4229
|
-
"
|
|
4230
|
-
"
|
|
4231
|
-
"other. A Frame of Size zero still takes a slot and flips the phase. It is a",
|
|
4227
|
+
"Anything that is not a nonempty list of arrays is refused the same way.",
|
|
4228
|
+
"",
|
|
4229
|
+
"**Routing**, `router x`: append x as one member of channel `C mod k`; the Count",
|
|
4230
|
+
"grows by one. A small cursor, built in the route itself, rebuilds the list of",
|
|
4231
|
+
"channels with the Frame added to that one, so a route costs one pass over the k channels and",
|
|
4232
|
+
"never replays the history (PR #482 review). Routing never evaluates x, never",
|
|
4233
|
+
"measures it, and never runs its methods, so a closure is kept uncalled, an",
|
|
4234
|
+
"array or group is kept as one member, and a Frame whose Size fails or runs code",
|
|
4235
|
+
"is routed like any other. A Frame of Size zero still takes a slot. It is a",
|
|
4232
4236
|
"mutating method, `apply_`, so through a name it is a functional update that",
|
|
4233
4237
|
"leaves the router as it was, and through a mutable name it writes the router in",
|
|
4234
4238
|
"place. Routing nil routes nothing and leaves the router as it was, as applying a",
|
|
@@ -4236,51 +4240,31 @@ export const HC_SOURCES = new Map([
|
|
|
4236
4240
|
"expression that applies the router, so it is never routed.",
|
|
4237
4241
|
"",
|
|
4238
4242
|
"**Observers.** A router declares its Count, Size and residual as a Denum does",
|
|
4239
|
-
"(007.25c): its Count C, its
|
|
4240
|
-
"each load is the sum of the Sizes of the children routed into that
|
|
4241
|
-
"
|
|
4242
|
-
"
|
|
4243
|
-
"
|
|
4244
|
-
"
|
|
4245
|
-
"
|
|
4246
|
-
"
|
|
4247
|
-
"
|
|
4248
|
-
"
|
|
4243
|
+
"(007.25c): its Count C, the sum of its channel loads and their alternating sum,",
|
|
4244
|
+
"where each load is the sum of the Sizes of the children routed into that",
|
|
4245
|
+
"channel. An empty channel has load 0, the empty sum; a nonempty channel's load",
|
|
4246
|
+
"is its native Size, which is that sum. Its fourth hash is the Denum of its",
|
|
4247
|
+
"Count and channel loads, `Denum [C, [load0, …]]`: the fourth hash recognizes",
|
|
4248
|
+
"an instance of this class intrinsically, as it recognizes a Denum, and reads",
|
|
4249
|
+
"each channel's Size once. That Denum is the router's numerical shadow; at",
|
|
4250
|
+
"Count zero there is none. Observation is where children are measured, so it is",
|
|
4251
|
+
"where their failures show, and declared observers run only when the router is",
|
|
4252
|
+
"observed: routing runs none of them, and observing writes nothing. The Denum",
|
|
4253
|
+
"forgets which Frames were routed and their order, so distinct routers can share",
|
|
4254
|
+
"one.",
|
|
4249
4255
|
"",
|
|
4250
4256
|
"**The projection law.** For every router r whose fourth hash exists, that is",
|
|
4251
4257
|
"every router with C ≥ 1 whose children have Sizes, and every Frame y,",
|
|
4252
|
-
"`(r y).#### = (r.####) y`: routing y into
|
|
4253
|
-
"
|
|
4254
|
-
"
|
|
4255
|
-
"
|
|
4256
|
-
"
|
|
4257
|
-
"
|
|
4258
|
-
"`(r0 y).#### = (Denum [0, 0, 0]) y`.",
|
|
4258
|
+
"`(r y).#### = (r.####) y`: routing y into channel `C mod k` and then observing",
|
|
4259
|
+
"adds `y.##` to that channel's load and one to C, which is exactly what applying",
|
|
4260
|
+
"the Denum to y does. The empty router is the boundary: it has routed nothing,",
|
|
4261
|
+
"so like the empty host `[]` its Count is zero and `.####` is nil, not a Denum",
|
|
4262
|
+
"conjured to make the equation look true. There the law reads through the",
|
|
4263
|
+
"zero-Count lifting the Denum class names, `(r0 y).#### = (Denum [0, [0, 0]]) y`.",
|
|
4259
4264
|
"",
|
|
4260
4265
|
"**Text.** A router prints as its fields and methods, and as text reads",
|
|
4261
|
-
"`RotorRouter([
|
|
4262
|
-
"
|
|
4263
|
-
"",
|
|
4264
|
-
"**Channels and division (007.27).** Two channels are the arity-two case of k",
|
|
4265
|
-
"ordered channels. `RotorRouter [ch0, …, chk−1]` takes k ≥ 1 arrays; two are",
|
|
4266
|
-
"this binary router, and any other number is a channel router. Every router",
|
|
4267
|
-
"stores `channels`; only the binary one also has `left`, `right` and `phase`,",
|
|
4268
|
-
"which it writes together with `channels`. A round-robin history from channel 0",
|
|
4269
|
-
"leaves the first C mod k channels one longer than the rest, so a channel",
|
|
4270
|
-
"router admits exactly the channels whose Counts are the dealing of C children",
|
|
4271
|
-
"into k, `round-robin [C, k]`, and refuses every other with",
|
|
4272
|
-
"`$!!.invalid-router`.",
|
|
4273
|
-
"Routing appends to channel C mod k, which for k = 2 is the phase's channel,",
|
|
4274
|
-
"directly, as the binary router does: a small cursor, `append-at`, rebuilds the",
|
|
4275
|
-
"list of channels with the Frame added to that one, so a route costs one pass",
|
|
4276
|
-
"over the k channels and never replays the history (PR #482 review).",
|
|
4277
|
-
"Its Size is the sum of its channel loads and its residual their alternating",
|
|
4278
|
-
"sum, as a channel Denum's are. Its fourth hash is the channel Denum of its",
|
|
4279
|
-
"Count and channel loads, `Denum [C, [load0, …]]`: the fourth hash recognizes an",
|
|
4280
|
-
"instance of this class with other than two channels intrinsically, as it",
|
|
4281
|
-
"recognizes a Denum, because the binary Denum the observers derive follows",
|
|
4282
|
-
"parity and not C mod k. So the projection law `(r y).#### = r.#### y` holds",
|
|
4283
|
-
"for every arity; at Count zero there is no Denum. Text reads `RotorRouter([ch0, ch1, …])`.",
|
|
4266
|
+
"`RotorRouter([ch0, ch1, …])`, the list of its channels, for every number of",
|
|
4267
|
+
"channels.",
|
|
4284
4268
|
"",
|
|
4285
4269
|
"`router ./ n`, also spelled `router / n`, re-deals the Frames it holds: it",
|
|
4286
4270
|
"reconstructs the order they were routed in from its channels, which their",
|
|
@@ -4314,30 +4298,16 @@ export const HC_SOURCES = new Map([
|
|
|
4314
4298
|
" .padded ((even = 1) ? {cs} : {cs & {.ch _; (ch.# = w) ? {ch} : {ch pad}}});",
|
|
4315
4299
|
" .flat ((((padded &| {_}) / w) .channels) &| {_});",
|
|
4316
4300
|
" (even = 1) ? {flat} : {flat &| {.x _; (x === (_^^^^ .pad)) ? {[]} : {[x]}}}}}};",
|
|
4317
|
-
".append-at {.at (_ .0); .item (_ .1); [.index 0; .target at; .item item; .out [];",
|
|
4318
|
-
" .apply_ {.v _; .i (_^ .index); .t (_^ .target); .it (_^ .item); .o (_^ .out);",
|
|
4319
|
-
" @out (o ((i = t) ? {it | v} : {v})); @index (i + 1);}]};",
|
|
4320
4301
|
".round-robin {.s (_ .0); .ways (_ .1); .q (((s - (s %% ways)) / ways).##);",
|
|
4321
4302
|
" [.low q; .short 0; .ok 1;",
|
|
4322
4303
|
" .apply_ {.c _; .lo (_^ .low); .seen (_^ .short); .fine (_^ .ok);",
|
|
4323
4304
|
" @ok ((((c = (lo + 1)) ? {seen = 0} : {c = lo}) ? {fine = 1}) ? {1} : {0}); @short ((c = lo) ? {1} : {seen});}]};",
|
|
4324
|
-
".
|
|
4325
|
-
" .phase (((lc.#) = (rc.#)) ? {2} : {1});",
|
|
4326
|
-
" .left lc;",
|
|
4327
|
-
" .right rc;",
|
|
4328
|
-
" .channels [lc, rc];",
|
|
4329
|
-
" .apply_ {.x _; .l (_^ .left); .r (_^ .right); .n (l.# + r.#);",
|
|
4330
|
-
" ((n %% 2) = 0) ? {.nl (l x); @left nl; @channels [nl, r]; @phase 1;} : {.nr (r x); @right nr; @channels [l, nr]; @phase 2;};};",
|
|
4331
|
-
" .# {.l (_^ .left); .r (_^ .right); l.# + r.#};",
|
|
4332
|
-
" .## {(channel-load (_^ .left)) + (channel-load (_^ .right))};",
|
|
4333
|
-
" .### {(channel-load (_^ .left)) - (channel-load (_^ .right))};",
|
|
4334
|
-
" ./ {.ways _; ((_^^ .history) (_^ .channels)) / ways};",
|
|
4335
|
-
" .toText {“RotorRouter(” (_^ .left) “,” (_^ .right) “)”}",
|
|
4336
|
-
" ]};",
|
|
4337
|
-
".channel-router {.cs _; [",
|
|
4305
|
+
".router-instance {.cs _; [",
|
|
4338
4306
|
" .channels cs;",
|
|
4339
4307
|
" .apply_ {.x _; .cs (_^ .channels); .n ((cs & {_.#}).##);",
|
|
4340
|
-
"
|
|
4308
|
+
" .at (n %% (cs.#)); .item [x];",
|
|
4309
|
+
" .cursor [.index 0; .target at; .item item; .out []; .apply_ {.v _; .i (_^ .index); .t (_^ .target); .it (_^ .item); .o (_^ .out); @out (o ((i = t) ? {it | v} : {v})); @index (i + 1);}];",
|
|
4310
|
+
" @channels ((cs | cursor) .out);};",
|
|
4341
4311
|
" .# {((_^ .channels) &| {_}).#};",
|
|
4342
4312
|
" .## {((_^ .channels) & {channel-load _}).##};",
|
|
4343
4313
|
" .### {((_^ .channels) & {channel-load _}).###};",
|
|
@@ -4346,27 +4316,28 @@ export const HC_SOURCES = new Map([
|
|
|
4346
4316
|
" ]};",
|
|
4347
4317
|
".RotorRouter {((_ ~ ([].<>)) ? {(__ .#) .> 0}) ? {.a __;",
|
|
4348
4318
|
" ((a &| {.x _; (x ~ ([].<>)) ? {[]} : {[x]}}).# = 0) ? {.cs (a & {_ | []}); .k (cs.#); .n ((cs &| {_}).#);",
|
|
4349
|
-
" ((k .> 0) ? {(((cs & {_.#}) | (round-robin [n, k])) .ok) = 1}) ? {
|
|
4319
|
+
" ((k .> 0) ? {(((cs & {_.#}) | (round-robin [n, k])) .ok) = 1}) ? {router-instance cs} : {$!!.invalid-router}",
|
|
4350
4320
|
" } : {$!!.invalid-router}} : {$!!.invalid-router}};",
|
|
4351
4321
|
"```",
|
|
4352
4322
|
"## Construction",
|
|
4353
4323
|
"",
|
|
4354
|
-
"A router holds exactly its
|
|
4355
|
-
"
|
|
4324
|
+
"A router holds exactly its channels. The initial router of two channels is",
|
|
4325
|
+
"present, both channels empty, Count zero, next route to channel 0",
|
|
4356
4326
|
"```",
|
|
4357
4327
|
"; .r0 (RotorRouter [[], []]);",
|
|
4358
|
-
"; [r0
|
|
4359
|
-
"# [
|
|
4328
|
+
"; [(r0.# %% 2), (r0.channels .0), (r0.channels .1), r0.#, “” r0]",
|
|
4329
|
+
"# [0, [], [], 0, “RotorRouter([[], []])”]",
|
|
4360
4330
|
"```",
|
|
4361
|
-
"Every admissible pair is a router,
|
|
4362
|
-
"children
|
|
4331
|
+
"Every admissible pair is a router, its next channel the parity of its Count: as",
|
|
4332
|
+
"many children in channel 0 as in channel 1 is even and next 0, one more in",
|
|
4333
|
+
"channel 0 is odd and next 1.",
|
|
4363
4334
|
"Preloads of any length are admitted on the same terms",
|
|
4364
4335
|
"```",
|
|
4365
|
-
"; [RotorRouter [[5], []], RotorRouter [[5], [6]], RotorRouter [[5, 7], [6]], RotorRouter [[1, 2, 3, 4], [5, 6, 7, 8]], RotorRouter [[1, 2, 3, 4, 5], [6, 7, 8, 9]]] & {[_.#, _
|
|
4366
|
-
"# [[1, 1], [2,
|
|
4336
|
+
"; [RotorRouter [[5], []], RotorRouter [[5], [6]], RotorRouter [[5, 7], [6]], RotorRouter [[1, 2, 3, 4], [5, 6, 7, 8]], RotorRouter [[1, 2, 3, 4, 5], [6, 7, 8, 9]]] & {[_.#, (_.# %% 2)]}",
|
|
4337
|
+
"# [[1, 1], [2, 0], [3, 1], [8, 0], [9, 1]]",
|
|
4367
4338
|
"```",
|
|
4368
|
-
"A pair that is not a
|
|
4369
|
-
"
|
|
4339
|
+
"A pair that is not a round-robin history from channel 0 is refused: channel 1",
|
|
4340
|
+
"ahead of channel 0, channel 0 more than one ahead, and the old phase-first form, whose three",
|
|
4370
4341
|
"arguments are not two channels. No history is invented for them",
|
|
4371
4342
|
"```",
|
|
4372
4343
|
"; [RotorRouter [[], [5]], RotorRouter [[5], [6, 7]], RotorRouter [[5, 6], []], RotorRouter [[1, 2, 3], [4]], RotorRouter [[], [1, 2, 3]]]",
|
|
@@ -4385,34 +4356,34 @@ export const HC_SOURCES = new Map([
|
|
|
4385
4356
|
"elements are counted for admissibility",
|
|
4386
4357
|
"```",
|
|
4387
4358
|
"; .Hijack [.apply {“hijack”}; 1];",
|
|
4388
|
-
"; [(RotorRouter [[.tag 9; 5], []]).
|
|
4359
|
+
"; [((RotorRouter [[.tag 9; 5], []]).channels .0), (((RotorRouter [Hijack, []]) 7).channels .1), RotorRouter [[.a 1; .b 2], [5]]]",
|
|
4389
4360
|
"# [[5], [7], $!!.invalid-router]",
|
|
4390
4361
|
"```",
|
|
4391
4362
|
"## Routing alternates",
|
|
4392
4363
|
"",
|
|
4393
|
-
"From the initial router, routing A, B and C sends A and C
|
|
4394
|
-
"and the next route goes
|
|
4364
|
+
"From the initial router, routing A, B and C sends A and C to channel 0 and B to",
|
|
4365
|
+
"channel 1, and the next route goes to channel 1",
|
|
4395
4366
|
"```",
|
|
4396
4367
|
"; .A [1, [2]]; .B “b”; .C {5 + 3};",
|
|
4397
4368
|
"; .r3 (((r0 A) B) C);",
|
|
4398
|
-
"; [r3
|
|
4369
|
+
"; [(r3.# %% 2), (r3.channels .0), (r3.channels .1), r3.#]",
|
|
4399
4370
|
"# [1, [[1, [2]], { 5 + 3 }], [“b”], 3]",
|
|
4400
4371
|
"; “” r3",
|
|
4401
|
-
"# “RotorRouter([[1, [2]], { 5 + 3 }],[“b”])”",
|
|
4372
|
+
"# “RotorRouter([[[1, [2]], { 5 + 3 }], [“b”]])”",
|
|
4402
4373
|
"```",
|
|
4403
4374
|
"The router that was routed into is left as it was",
|
|
4404
4375
|
"```",
|
|
4405
|
-
"; [r0
|
|
4406
|
-
"# [
|
|
4376
|
+
"; [(r0.# %% 2), (r0.channels .0), (r0.channels .1)]",
|
|
4377
|
+
"# [0, [], []]",
|
|
4407
4378
|
"```",
|
|
4408
|
-
"The
|
|
4409
|
-
"admissible again: routing from Count 0 through Count 6 alternates",
|
|
4410
|
-
"
|
|
4379
|
+
"The next channel is the parity of the Count after every route, so each",
|
|
4380
|
+
"successor is admissible again: routing from Count 0 through Count 6 alternates",
|
|
4381
|
+
"channel 0, 1, 0, …",
|
|
4411
4382
|
"```",
|
|
4412
4383
|
"; .steps [r0, (r0 1), ((r0 1) 2), (((r0 1) 2) 3), ((((r0 1) 2) 3) 4), (((((r0 1) 2) 3) 4) 5), ((((((r0 1) 2) 3) 4) 5) 6)];",
|
|
4413
|
-
"; [steps & {_.#}, steps & {_
|
|
4414
|
-
"# [[0, 1, 2, 3, 4, 5, 6], [
|
|
4415
|
-
"; steps & {(RotorRouter [_.
|
|
4384
|
+
"; [steps & {_.#}, steps & {(_.# %% 2)}, steps & {(_.channels .0).#}, steps & {(_.channels .1).#}]",
|
|
4385
|
+
"# [[0, 1, 2, 3, 4, 5, 6], [0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 2, 2, 3, 3], [0, 0, 1, 1, 2, 2, 3]]",
|
|
4386
|
+
"; steps & {(RotorRouter [(_.channels .0), (_.channels .1)]) = _}",
|
|
4416
4387
|
"# [<>, <>, <>, <>, <>, <>, <>]",
|
|
4417
4388
|
"```",
|
|
4418
4389
|
"## Routing keeps the Frame",
|
|
@@ -4420,13 +4391,13 @@ export const HC_SOURCES = new Map([
|
|
|
4420
4391
|
"A channel member is the routed Frame itself. An array or a group is routed as",
|
|
4421
4392
|
"one member, never spread into its elements, and a closure is kept, not called.",
|
|
4422
4393
|
"Iterating a channel yields its members as they are. Reading a closure by dot",
|
|
4423
|
-
"from an aggregate, `r3.
|
|
4394
|
+
"from an aggregate, `(r3.channels .0) .1`, answers a method bound to that aggregate,",
|
|
4424
4395
|
"which is the general rule for methods and not the router's, so the closure's",
|
|
4425
4396
|
"identity is seen by iterating",
|
|
4426
4397
|
"```",
|
|
4427
|
-
"; [r3.
|
|
4398
|
+
"; [(r3.channels .0) .0 === A, (r3.channels .1) .0 === B, (r3.channels .0) & {_ === C}]",
|
|
4428
4399
|
"# [<>, <>, [(), <>]]",
|
|
4429
|
-
"; [(r0 [1, 2]).
|
|
4400
|
+
"; [((r0 [1, 2]).channels .0), ((r0 (4, 5)).channels .0), ((r0 {5 + 3}).channels .0), ((r0 []).channels .0)]",
|
|
4430
4401
|
"# [[[1, 2]], [(4, 5)], [{ 5 + 3 }], [[]]]",
|
|
4431
4402
|
"```",
|
|
4432
4403
|
"A Frame held through a mutable name is the same Frame in the channel, so a",
|
|
@@ -4436,19 +4407,19 @@ export const HC_SOURCES = new Map([
|
|
|
4436
4407
|
"; .kid_ [.n 1; .set_ {@n _;}];",
|
|
4437
4408
|
"; .rk (r0 kid_);",
|
|
4438
4409
|
"; kid_.set_ 5;",
|
|
4439
|
-
"; [rk.
|
|
4410
|
+
"; [((rk.channels .0) .0) === kid_, ((rk.channels .0) .0).n]",
|
|
4440
4411
|
"# [<>, 5]",
|
|
4441
|
-
"; [(rk.
|
|
4412
|
+
"; [(((rk.channels .0) .0).set_ 9).n, kid_.n, ((rk.channels .0) .0).n]",
|
|
4442
4413
|
"# [9, 5, 5]",
|
|
4443
4414
|
"```",
|
|
4444
4415
|
"## Preloaded states",
|
|
4445
4416
|
"",
|
|
4446
|
-
"An admissible preload continues its history: here one child
|
|
4447
|
-
"
|
|
4417
|
+
"An admissible preload continues its history: here one child in channel 0, so",
|
|
4418
|
+
"Count 1, and the next two routes go to channel 1 then channel 0",
|
|
4448
4419
|
"```",
|
|
4449
4420
|
"; .p1 (RotorRouter [[A], []]);",
|
|
4450
4421
|
"; .p2 ((p1 B) C);",
|
|
4451
|
-
"; [p1
|
|
4422
|
+
"; [(p1.# %% 2), p1.#, (p2.# %% 2), (p2.channels .0), (p2.channels .1), (p1.channels .1)]",
|
|
4452
4423
|
"# [1, 1, 1, [[1, [2]], { 5 + 3 }], [“b”], []]",
|
|
4453
4424
|
"; [p2 = r3, p2 = (RotorRouter [[A, C], [B]])]",
|
|
4454
4425
|
"# [<>, <>]",
|
|
@@ -4462,21 +4433,21 @@ export const HC_SOURCES = new Map([
|
|
|
4462
4433
|
"; .m_ (RotorRouter [ch, []]);",
|
|
4463
4434
|
"; m_ B;",
|
|
4464
4435
|
"; m_ C;",
|
|
4465
|
-
"; [m_
|
|
4436
|
+
"; [(m_.# %% 2), (m_.channels .0), (m_.channels .1), (u.channels .0), (v.channels .0), ch]",
|
|
4466
4437
|
"# [1, [[1, [2]], { 5 + 3 }], [“b”], [[1, [2]]], [[1, [2]]], [[1, [2]]]]",
|
|
4467
|
-
"; [u.
|
|
4438
|
+
"; [(u.channels .0) === ch, (u.channels .0) === (v.channels .0), ((u.channels .0) .0) === ((v.channels .0) .0)]",
|
|
4468
4439
|
"# [(), (), <>]",
|
|
4469
4440
|
"```",
|
|
4470
4441
|
"A router captured by a closure, mapped, or reduced into routes the same way,",
|
|
4471
4442
|
"and the captured one stays as it was",
|
|
4472
4443
|
"```",
|
|
4473
4444
|
"; .start (RotorRouter [[], []]); .step {start _};",
|
|
4474
|
-
"; [(step 5).
|
|
4445
|
+
"; [((step 5).channels .0), ((step 3).channels .0), (start.channels .0)]",
|
|
4475
4446
|
"# [[5], [3], []]",
|
|
4476
|
-
"; [r0, p1] & {(_ 5).
|
|
4447
|
+
"; [r0, p1] & {((_ 5).channels .1)}",
|
|
4477
4448
|
"# [[], [5]]",
|
|
4478
4449
|
"; “” ([A, B, C] | r0)",
|
|
4479
|
-
"# “RotorRouter([[1, [2]], { 5 + 3 }],[“b”])”",
|
|
4450
|
+
"# “RotorRouter([[[1, [2]], { 5 + 3 }], [“b”]])”",
|
|
4480
4451
|
"```",
|
|
4481
4452
|
"## Routing measures nothing",
|
|
4482
4453
|
"",
|
|
@@ -4489,21 +4460,21 @@ export const HC_SOURCES = new Map([
|
|
|
4489
4460
|
"; .Failing [.## {[].nope}; 1];",
|
|
4490
4461
|
"; .Cyclic [.## {_^.##}];",
|
|
4491
4462
|
"; .rf ((((r0 Counted) Failing) Cyclic) Counted);",
|
|
4492
|
-
"; [rf
|
|
4493
|
-
"# [
|
|
4463
|
+
"; [(rf.# %% 2), (rf.channels .0).#, (rf.channels .1).#, counter_.n]",
|
|
4464
|
+
"# [0, 2, 2, 0]",
|
|
4494
4465
|
"```",
|
|
4495
4466
|
"Observing the router is where they are measured, so it is where they fail and",
|
|
4496
|
-
"where the counting code runs. The fourth hash reads
|
|
4497
|
-
"
|
|
4467
|
+
"where the counting code runs. The fourth hash reads each channel's Size once,",
|
|
4468
|
+
"so a child's Size is read once",
|
|
4498
4469
|
"```",
|
|
4499
4470
|
"; (r0 Failing).####",
|
|
4500
4471
|
"# $!.name-missing “...",
|
|
4501
4472
|
"; (r0 Cyclic).####",
|
|
4502
4473
|
"# $!.cyclic-observation .##",
|
|
4503
4474
|
"; “” ((r0 Counted).####)",
|
|
4504
|
-
"# “Denum(1,5,0)”",
|
|
4475
|
+
"# “Denum(1,[5, 0])”",
|
|
4505
4476
|
"; counter_.n",
|
|
4506
|
-
"#
|
|
4477
|
+
"# 1",
|
|
4507
4478
|
"```",
|
|
4508
4479
|
"An error is the answer of the expression that applies the router, so it is",
|
|
4509
4480
|
"never routed. A diagnostic failure such as a missing name is an error too",
|
|
@@ -4516,30 +4487,30 @@ export const HC_SOURCES = new Map([
|
|
|
4516
4487
|
"```",
|
|
4517
4488
|
"Routing nil routes nothing",
|
|
4518
4489
|
"```",
|
|
4519
|
-
"; [(r0 ())
|
|
4520
|
-
"# [
|
|
4490
|
+
"; [((r0 ()).# %% 2), ((r0 ()).channels .0), (p1 ()).#]",
|
|
4491
|
+
"# [0, [], 1]",
|
|
4521
4492
|
"```",
|
|
4522
4493
|
"## Empty and zero",
|
|
4523
4494
|
"",
|
|
4524
4495
|
"The initial router has routed no children, so its Count is zero, and like the",
|
|
4525
4496
|
"empty host it has no Denum. Its Size and residual still read zero, and it is a",
|
|
4526
|
-
"present router
|
|
4497
|
+
"present router. The Denum of Count zero is a different thing, a Denum",
|
|
4527
4498
|
"constructed as such, which routing from the router reaches after one route",
|
|
4528
4499
|
"```",
|
|
4529
|
-
"; [r0.#, r0.##, r0.###, r0
|
|
4530
|
-
"# [0, 0, 0,
|
|
4500
|
+
"; [r0.#, r0.##, r0.###, (r0.# %% 2), r0.####, [].####]",
|
|
4501
|
+
"# [0, 0, 0, 0, (), ()]",
|
|
4531
4502
|
"; Denums <- './hc/denum.hc';",
|
|
4532
|
-
"; [((r0 0).####) = ((Denums.Denum [0, 0, 0]) 0), ((r0 []).####) = ([] []).####]",
|
|
4503
|
+
"; [((r0 0).####) = ((Denums.Denum [0, [0, 0]]) 0), ((r0 []).####) = ([] []).####]",
|
|
4533
4504
|
"# [<>, <>]",
|
|
4534
4505
|
"```",
|
|
4535
|
-
"A Frame of Size zero takes a slot and
|
|
4506
|
+
"A Frame of Size zero takes a slot and moves the next channel, and an empty array",
|
|
4536
4507
|
"routed as a child has Size 1, while an empty channel has load 0",
|
|
4537
4508
|
"```",
|
|
4538
4509
|
"; .z (r0 0);",
|
|
4539
|
-
"; [z
|
|
4540
|
-
"# [1, [0], 1, “Denum(1,0,0)”]",
|
|
4510
|
+
"; [(z.# %% 2), (z.channels .0), z.#, “” (z.####)]",
|
|
4511
|
+
"# [1, [0], 1, “Denum(1,[0, 0])”]",
|
|
4541
4512
|
"; [“” ((r0 []).####), “” (((r0 []) []).####), “” ((((r0 0) 0) 0).####)]",
|
|
4542
|
-
"# [“Denum(1,1,0)”, “Denum(2,1,1)”, “Denum(3,0,0)”]",
|
|
4513
|
+
"# [“Denum(1,[1, 0])”, “Denum(2,[1, 1])”, “Denum(3,[0, 0])”]",
|
|
4543
4514
|
"```",
|
|
4544
4515
|
"## The router's Denum",
|
|
4545
4516
|
"",
|
|
@@ -4549,39 +4520,39 @@ export const HC_SOURCES = new Map([
|
|
|
4549
4520
|
"```",
|
|
4550
4521
|
"; .shared [[], []];",
|
|
4551
4522
|
"; .mix ((((((((r0 “hello”) 7) [[1, 2], [3]]) (4, 5)) shared) shared) {5 + 3}) <>);",
|
|
4552
|
-
"; [mix.
|
|
4523
|
+
"; [(mix.channels .0), (mix.channels .1)]",
|
|
4553
4524
|
"# [[“hello”, [[1, 2], [3]], [[], []], { 5 + 3 }], [7, (4, 5), [[], []], <>]]",
|
|
4554
|
-
"; [mix.
|
|
4555
|
-
"# [[5, 6, 2, 9], [7, 9, 2, 1], “Denum(8,22,19)”]",
|
|
4525
|
+
"; [(mix.channels .0) & {_.##}, (mix.channels .1) & {_.##}, “” (mix.####)]",
|
|
4526
|
+
"# [[5, 6, 2, 9], [7, 9, 2, 1], “Denum(8,[22, 19])”]",
|
|
4556
4527
|
"; “” (((r0 123456789012345678901234567890) 987654321098765432109876543210).####)",
|
|
4557
|
-
"# “Denum(2,123456789012345678901234567890,987654321098765432109876543210)”",
|
|
4528
|
+
"# “Denum(2,[123456789012345678901234567890, 987654321098765432109876543210])”",
|
|
4558
4529
|
"```",
|
|
4559
|
-
"A router's Denum is `Denum
|
|
4560
|
-
"router's
|
|
4530
|
+
"A router's Denum is `Denum [C, [load0, load1]]` of its own channels, and its",
|
|
4531
|
+
"parity is the router's, for every Count from 1 to 6 and for preloads",
|
|
4561
4532
|
"```",
|
|
4562
4533
|
"; .sh (steps & {_.####});",
|
|
4563
4534
|
"; [sh & {_ = ()}, sh & {_.#}]",
|
|
4564
4535
|
"# [[<>, (), (), (), (), (), ()], [(), 1, 2, 3, 4, 5, 6]]",
|
|
4565
|
-
"; [steps &| {.k _; (k.# .> 0) ? {[k
|
|
4536
|
+
"; [steps &| {.k _; (k.# .> 0) ? {[(k.# %% 2) = (k.#### .# %% 2)]} : {[]}}, (RotorRouter [[2, 3], [1]]).#### = (Denums.Denum [3, [5, 1]])]",
|
|
4566
4537
|
"# [[<>, <>, <>, <>, <>, <>], <>]",
|
|
4567
4538
|
"```",
|
|
4568
4539
|
"## Observing commutes with routing",
|
|
4569
4540
|
"",
|
|
4570
4541
|
"Routing each child of an array X in turn, from the initial router, is the",
|
|
4571
|
-
"reduce `X | r0`. Its
|
|
4572
|
-
"
|
|
4542
|
+
"reduce `X | r0`. Its channel 0 holds the children at even positions and its",
|
|
4543
|
+
"channel 1 those at odd positions, and its next channel is the parity of X's Count.",
|
|
4573
4544
|
"That interleaving is the admissibility invariant, so the same router is",
|
|
4574
4545
|
"constructed directly from the two channels",
|
|
4575
4546
|
"```",
|
|
4576
4547
|
"; .X [5, “ab”, [1, 2]];",
|
|
4577
4548
|
"; .rx (X | r0);",
|
|
4578
|
-
"; [rx.
|
|
4549
|
+
"; [(rx.channels .0), (rx.channels .1), (rx.# %% 2), rx = (RotorRouter [[5, [1, 2]], [“ab”]])]",
|
|
4579
4550
|
"# [[5, [1, 2]], [“ab”], 1, <>]",
|
|
4580
4551
|
"```",
|
|
4581
4552
|
"For every router whose fourth hash exists, routing Y then observing is applying",
|
|
4582
4553
|
"the router's Denum to Y, which adds one to the Count. Its fourth hash is X's,",
|
|
4583
4554
|
"Count included. The law holds for routers built by routing and for admissible",
|
|
4584
|
-
"preloads alike, in both
|
|
4555
|
+
"preloads alike, in both parities, and for a zero-Size child",
|
|
4585
4556
|
"```",
|
|
4586
4557
|
"; .Y [[], [], []];",
|
|
4587
4558
|
"; [(rx.####) = X.####, ((rx Y).####) = (X Y).####, ((rx Y).####) = ((rx.####) Y), (rx.####).# = X.#, ((rx Y).####).# = (X.# + 1)]",
|
|
@@ -4589,7 +4560,7 @@ export const HC_SOURCES = new Map([
|
|
|
4589
4560
|
"; [((p1 Y).####) = ((p1.####) Y), ((p2 {5 + 3}).####) = ((p2.####) {5 + 3}), ((p1 0).####) = ((p1.####) 0)]",
|
|
4590
4561
|
"# [<>, <>, <>]",
|
|
4591
4562
|
"; .pre [RotorRouter [[A], []], RotorRouter [[A], [B]], RotorRouter [[A, B], [C]], RotorRouter [[1, 2, 3, 4], [5, 6, 7, 8]], RotorRouter [[1, 2, 3, 4, 5], [6, 7, 8, 9]]];",
|
|
4592
|
-
"; [pre & {((_ Y).####) = ((_.####) Y)}, pre & {((_ 0).####) = ((_.####) 0)}, pre & {(_ Y)
|
|
4563
|
+
"; [pre & {((_ Y).####) = ((_.####) Y)}, pre & {((_ 0).####) = ((_.####) 0)}, pre & {((_ Y).# %% 2) = (((_.####) Y).# %% 2)}]",
|
|
4593
4564
|
"# [[<>, <>, <>, <>, <>], [<>, <>, <>, <>, <>], [<>, <>, <>, <>, <>]]",
|
|
4594
4565
|
"```",
|
|
4595
4566
|
"The same holds at every step of a walk, Count 1 to 6, and a router can never",
|
|
@@ -4597,7 +4568,7 @@ export const HC_SOURCES = new Map([
|
|
|
4597
4568
|
"```",
|
|
4598
4569
|
"; steps &| {.k _; (k.# .> 0) ? {[((k Y).####) = ((k.####) Y)]} : {[]}}",
|
|
4599
4570
|
"# [<>, <>, <>, <>, <>, <>]",
|
|
4600
|
-
"; steps &| {.k _; (k.# .> 0) ? {[[((k 4).
|
|
4571
|
+
"; steps &| {.k _; (k.# .> 0) ? {[[(((k 4).channels .0).# - (k.channels .0).#), ((((k.####) 4).loads .0) - (k.#### .loads .0))]]} : {[]}}",
|
|
4601
4572
|
"# [[0, 0], [1, 4], [0, 0], [1, 4], [0, 0], [1, 4]]",
|
|
4602
4573
|
"```",
|
|
4603
4574
|
"A failed Size is the answer on both sides: the router routes the Frame and its",
|
|
@@ -4609,10 +4580,10 @@ export const HC_SOURCES = new Map([
|
|
|
4609
4580
|
"The empty host is the boundary. `[].####` is nil, so `X.####` fails the first",
|
|
4610
4581
|
"equation when X is empty, and so does the initial router, which has routed",
|
|
4611
4582
|
"nothing and so has Count zero: it has no Denum, and none is faked. The law there",
|
|
4612
|
-
"reads through the Denum class's zero-Count lifting, `Denum [0, 0, 0]`, and after",
|
|
4583
|
+
"reads through the Denum class's zero-Count lifting, `Denum [0, [0, 0]]`, and after",
|
|
4613
4584
|
"one route the equation holds again",
|
|
4614
4585
|
"```",
|
|
4615
|
-
"; [r0.####, ([] | r0) = r0, (([] | r0).####) = [].####, (([Y] | r0).####) = ([] Y).####, ((r0 Y).####) = ((Denums.Denum [0, 0, 0]) Y), ((r0 0).####) = ((Denums.Denum [0, 0, 0]) 0)]",
|
|
4586
|
+
"; [r0.####, ([] | r0) = r0, (([] | r0).####) = [].####, (([Y] | r0).####) = ([] Y).####, ((r0 Y).####) = ((Denums.Denum [0, [0, 0]]) Y), ((r0 0).####) = ((Denums.Denum [0, [0, 0]]) 0)]",
|
|
4616
4587
|
"# [(), <>, <>, <>, <>, <>]",
|
|
4617
4588
|
"```",
|
|
4618
4589
|
"## The Denum forgets",
|
|
@@ -4643,7 +4614,7 @@ export const HC_SOURCES = new Map([
|
|
|
4643
4614
|
"```",
|
|
4644
4615
|
"; .seen (((r0 A) B) C);",
|
|
4645
4616
|
"; seen.####;",
|
|
4646
|
-
"; [seen = r3, seen
|
|
4617
|
+
"; [seen = r3, (seen.# %% 2), (seen.channels .0).#, (seen.channels .1).#]",
|
|
4647
4618
|
"# [<>, 1, 2, 1]",
|
|
4648
4619
|
"```",
|
|
4649
4620
|
"## Reading the receiver",
|
|
@@ -4652,7 +4623,7 @@ export const HC_SOURCES = new Map([
|
|
|
4652
4623
|
"as one member, and the router reads only its own fields and its own Count",
|
|
4653
4624
|
"```",
|
|
4654
4625
|
"; .masked (r0 [.phase 1; .left [8]; .x 9; .l [7]; .n 1; 4]);",
|
|
4655
|
-
"; [masked
|
|
4626
|
+
"; [(masked.# %% 2), (masked.channels .0).#, ((masked.channels .0) .0).x, (masked.channels .1)]",
|
|
4656
4627
|
"# [1, 1, 9, []]",
|
|
4657
4628
|
"```",
|
|
4658
4629
|
"Carets count lexically (spec a06). Inside a branch, `_^` is the method's own",
|
|
@@ -4680,8 +4651,8 @@ export const HC_SOURCES = new Map([
|
|
|
4680
4651
|
"printed form is matched here by its beginning",
|
|
4681
4652
|
"```",
|
|
4682
4653
|
"; RotorRouter [[5], []]",
|
|
4683
|
-
"# [.
|
|
4684
|
-
"; (RotorRouter [[5], []]) = [.
|
|
4654
|
+
"# [.channels [[5], []]; .apply_ {...",
|
|
4655
|
+
"; (RotorRouter [[5], []]) = [.channels [[5], []]; .apply_ { .x _; .cs (_^ .channels); .n ((cs & { _ .# }) .##); .at (n %% (cs .#)); .item [x]; .cursor [.index 0; .target at; .item item; .out []; .apply_ { .v _; .i (_^ .index); .t (_^ .target); .it (_^ .item); .o (_^ .out); @out (o ((i = t) ? { it | v } : { v })); @index (i + 1); }]; @channels ((cs | cursor) .out); }; .# { ((_^ .channels) &| { _ }) .# }; .## { ((_^ .channels) & { channel-load _ }) .## }; .### { ((_^ .channels) & { channel-load _ }) .### }; ./ { .ways _; ((_^^ .history) (_^ .channels)) / ways }; .toText { “RotorRouter(” (_^ .channels) “)” };]",
|
|
4685
4656
|
"# <>",
|
|
4686
4657
|
"```",
|
|
4687
4658
|
"## Importing",
|
|
@@ -4691,7 +4662,7 @@ export const HC_SOURCES = new Map([
|
|
|
4691
4662
|
"```",
|
|
4692
4663
|
"; Routers <- './hc/rotor-router.hc';",
|
|
4693
4664
|
"; [(Routers.RotorRouter [[], []]) = r0, “” ((Routers.RotorRouter [[], []]) 4), (((Routers.RotorRouter [[], []]) 4).####) = [4].####]",
|
|
4694
|
-
"# [<>, “RotorRouter([4],[])”, <>]",
|
|
4665
|
+
"# [<>, “RotorRouter([[4], []])”, <>]",
|
|
4695
4666
|
"",
|
|
4696
4667
|
].join("\n"),
|
|
4697
4668
|
],
|