hclang 0.46.0 → 0.48.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 +0 -520
- package/esm/lib/execute/hc-eval.js +0 -2
- package/esm/lib/frames/frame-array.js +1 -1
- package/esm/lib/frames/frame-expr.js +3 -3
- package/esm/lib/frames/frame-lazy.js +1 -1
- package/esm/lib/frames/frame-list.js +1 -1
- package/esm/lib/frames/frame-name.js +0 -8
- package/esm/lib/frames/frame-symbol.js +1 -1
- package/esm/lib/frames/frame.js +4 -30
- package/esm/lib/frames.js +0 -2
- package/esm/lib/ops.js +0 -3
- package/esm/lib/version.js +1 -1
- package/package.json +1 -1
- package/esm/lib/execute/denum-prologue.js +0 -88
- package/esm/lib/frames/denum-hash.js +0 -166
- package/esm/lib/frames/denum.js +0 -381
- package/esm/lib/ops/denum.js +0 -131
|
@@ -2735,526 +2735,6 @@ export const HC_SOURCES = new Map([
|
|
|
2735
2735
|
"",
|
|
2736
2736
|
].join("\n"),
|
|
2737
2737
|
],
|
|
2738
|
-
[
|
|
2739
|
-
"hc/denum.hc",
|
|
2740
|
-
[
|
|
2741
|
-
"#!/usr/bin/env hc",
|
|
2742
|
-
"```",
|
|
2743
|
-
"Denum (occurrence/figure 007.31, 007.32, 007.32b)",
|
|
2744
|
-
"",
|
|
2745
|
-
"A Denum is a constructed state of the binary Cayley–Dickson step ladder: a",
|
|
2746
|
-
"schema `CD[n]`, a retained application Count, and a nonnegative integer load on",
|
|
2747
|
-
"every signature channel. It is not a conventional number. Its conventional",
|
|
2748
|
-
"algebraic value is an observation, `d.coordinates ()`, and opposite channels stay",
|
|
2749
|
-
"separately counted after every operation, so `X + Opp X` is a present, nonempty",
|
|
2750
|
-
"Denum that merely observes as zero.",
|
|
2751
|
-
"",
|
|
2752
|
-
"`x.#n` answers a Denum of rank n for n from 0 to 5, and there is no `#n=`",
|
|
2753
|
-
'(see "The ranked hash" below). `Denum [rank, count, loads]` builds one directly.',
|
|
2754
|
-
"`Denum` is an ordinary HC class, like `Demi`; its arithmetic is the Cayley–Dickson",
|
|
2755
|
-
"recurrence `(a,b)(c,d) = (ac − d̄b, da + bc̄)`, computed by the one pure native",
|
|
2756
|
-
"seam `denum-engine` (`lib/ops/denum.ts`, over the typed reference in",
|
|
2757
|
-
"`lib/frames/denum.ts`), so no multiplication table is written in HC or in",
|
|
2758
|
-
"TypeScript. Everything else a Denum does is in this file.",
|
|
2759
|
-
"",
|
|
2760
|
-
"**Ranks and channels.** Rank n is the schema `CD[n]`, the rung of the step",
|
|
2761
|
-
"ladder, not the arity. Rank 0 has one unsigned channel, `e_ε`. Rank n of 1 or",
|
|
2762
|
-
"more has 2ⁿ channels, `±e_b` for every direction `b` of n−1 bits, positives",
|
|
2763
|
-
"first and then negatives, each in direction order:",
|
|
2764
|
-
"",
|
|
2765
|
-
" CD[0] e_ε",
|
|
2766
|
-
" CD[1] e_ε, -e_ε",
|
|
2767
|
-
" CD[2] e_0, e_1, -e_0, -e_1",
|
|
2768
|
-
" CD[3] e_00, e_01, e_10, e_11, -e_00, -e_01, -e_10, -e_11",
|
|
2769
|
-
" CD[4] ±e_b for b in {0,1}³ 16 channels",
|
|
2770
|
-
" CD[5] ±e_b for b in {0,1}⁴ 32 channels",
|
|
2771
|
-
"",
|
|
2772
|
-
"A minus names a *signature*, never a negative load: every load is a Count.",
|
|
2773
|
-
"`d.signatures ()` lists the native names in channel order.",
|
|
2774
|
-
"",
|
|
2775
|
-
"**State.** `d.rank`, `d.schema` (the text `CD[n]`), `d.count` (the full",
|
|
2776
|
-
"application Count, kept apart from the loads) and `d.loads` (one Count per",
|
|
2777
|
-
"channel). Anything that is not a rank from 0 to 5, a Count, and exactly the",
|
|
2778
|
-
"rank's number of Counts is refused with `$!!.invalid-denum`. `Denum [0, 0, [0]]`,",
|
|
2779
|
-
"an explicit zero-load D0, is present: it is neither the missing host that",
|
|
2780
|
-
"`[].#0` leaves nil nor a nonempty Denum that observes as zero.",
|
|
2781
|
-
"",
|
|
2782
|
-
"**Arithmetic.** `+`, `-` and `*` take another Denum, and only a Denum: the",
|
|
2783
|
-
"right operand is reconstructed from its `rank`, `count` and `loads` through the",
|
|
2784
|
-
"shipped constructor and must be `=` to that reconstruction, the same test `x.#n`",
|
|
2785
|
-
"applies to a source. A lookalike aggregate with the same fields, a Count, text",
|
|
2786
|
-
"or a list is `$!!.invalid-denum`. Operands of different",
|
|
2787
|
-
"rank are both promoted to the larger rank first (`promote`), and the result is a",
|
|
2788
|
-
"fresh Denum of that rank:",
|
|
2789
|
-
"",
|
|
2790
|
-
"- `a + b` adds corresponding loads and keeps opposite channels separate.",
|
|
2791
|
-
"- `a * b` is the ordered Cartesian product of weighted signatures: loads",
|
|
2792
|
-
" multiply, the signed destination is the recurrence's, and only identical full",
|
|
2793
|
-
" signatures aggregate. Operand order and parentheses are kept, and from",
|
|
2794
|
-
" rank 4 the product is not associative.",
|
|
2795
|
-
"- `a - b` is `a + b.opp ()`: subtraction is addition of the opposite, observed,",
|
|
2796
|
-
" never erased.",
|
|
2797
|
-
"- `d.opp ()` swaps the loads of `+e_b` and `-e_b`; a D0 is promoted to D1 first.",
|
|
2798
|
-
"- `d.conj ()` keeps the scalar signatures and swaps every other pair.",
|
|
2799
|
-
"- `d.promote k` embeds into rank k by the old-summand map, `±e_b ↦ ±e_(0b)`,",
|
|
2800
|
-
" keeping Count and loads and starting new channels at zero. A lower k is",
|
|
2801
|
-
" `$!.denum-demotion`.",
|
|
2802
|
-
"- `d.coordinates ()` is the algebraic observation: the signed coordinate of each",
|
|
2803
|
-
" direction, positive load minus negative load, `S_b = W₊,b − W₋,b`.",
|
|
2804
|
-
" `d.coordinates <>` is the directional observation: the unsigned coordinate,",
|
|
2805
|
-
" positive load plus negative load, `U_b = W₊,b + W₋,b`, which forgets the",
|
|
2806
|
-
" signature and keeps all load. Each is an ordered list of integers, width 1 at",
|
|
2807
|
-
" rank 0 and 2ⁿ⁻¹ at rank n, and not the Denum; neither changes the Denum or",
|
|
2808
|
-
" returns its Count. At rank 0 both are `[W_ε]`. The only arguments are nil",
|
|
2809
|
-
" `()` and true `<>`; any other argument (a Count, text, a list) is",
|
|
2810
|
-
" `$!!.unary-observation`, never coerced by truthiness.",
|
|
2811
|
-
"- `d.observe ()` is the deprecated v0.45.0 spelling of `d.coordinates ()`,",
|
|
2812
|
-
" kept only as a compatibility alias with exactly the signed result. It takes",
|
|
2813
|
-
" no unsigned argument; use `d.coordinates`.",
|
|
2814
|
-
"",
|
|
2815
|
-
"**Count.** The candidate laws of 007.32 section 6 hold for these new operations",
|
|
2816
|
-
"only: `C(a+b) = C(a)+C(b)`, `C(a*b) = C(a)·C(b)` and `C(Opp a) = C(a)`, and",
|
|
2817
|
-
"promotion and conjugation keep Count. Count is carried, never derived from the",
|
|
2818
|
-
"loads, and it is not the application phase `C mod arity`. `Demi` and its `+`,",
|
|
2819
|
-
"`-`, `*` and `./` are unchanged. This is a software construction of a supplied",
|
|
2820
|
-
"recurrence, not a derivation of it from bare counting.",
|
|
2821
|
-
"",
|
|
2822
|
-
"**Observers.** A Denum declares its own Count (`d.#`), Size (`d.##`, the total",
|
|
2823
|
-
"load) and residual (`d.###`, positive minus negative total, 0 at rank 0). Its",
|
|
2824
|
-
"`.####` is therefore the ordinary derived Demi of those three, which is binary",
|
|
2825
|
-
"and forgets the directions; `d.#n` is the Denum.",
|
|
2826
|
-
"",
|
|
2827
|
-
"**The ranked hash.** For any Frame x, `x.#n` for n from 0 to 5 answers the",
|
|
2828
|
-
"Denum of rank n, `nil` when x has no Count or Count zero, as `x.####` does.",
|
|
2829
|
-
"For an ordinary or binary host `x.#1` has the Count and the left and right",
|
|
2830
|
-
"loads of `x.####`. A `RotorRouter` of more than two channels is the exception:",
|
|
2831
|
-
"`.####` answers its channel Demi, and `.#n` does not special-case it, so it is",
|
|
2832
|
-
"the two-channel projection of the router's Count, Size and residual.",
|
|
2833
|
-
"Bare `x.#` is still the Count. The host is built from the three observers it",
|
|
2834
|
-
"answers, Count C, Size s and residual r: rank 0 keeps the load s, and rank",
|
|
2835
|
-
"n ≥ 1 puts (s+r)/2 on `e_0…0` and (s−r)/2 on `-e_0…0`, the two channels the",
|
|
2836
|
-
"fourth hash reads as left and right, with every other channel zero. A host's",
|
|
2837
|
-
"applications carry no higher signature, so none is routed to them. That is",
|
|
2838
|
-
"construction, and it is not promotion. A Denum instance answers `x.#n` by",
|
|
2839
|
-
"promotion to rank n (and `$!.denum-demotion` below its own rank), keeping Count",
|
|
2840
|
-
"and loads, and a forged lookalike is not recognized. A rank above 5 is",
|
|
2841
|
-
"`$!.denum-rank`.",
|
|
2842
|
-
"",
|
|
2843
|
-
"The class is evaluated from the compiled-in bundle the first time a ranked hash",
|
|
2844
|
-
"needs it, in a namespace of its own (`lib/execute/denum-prologue.ts`), so this",
|
|
2845
|
-
"file must not import.",
|
|
2846
|
-
"```",
|
|
2847
|
-
".denum-state {.r (_ .0); .c (_ .1); .l (_ .2); .s (denum-engine [9, r, c, l]); [",
|
|
2848
|
-
" .rank r;",
|
|
2849
|
-
" .schema s;",
|
|
2850
|
-
" .count c;",
|
|
2851
|
-
" .loads l;",
|
|
2852
|
-
" .# {_^.count};",
|
|
2853
|
-
" .## {(_^ .loads).##};",
|
|
2854
|
-
" .### {denum-engine [10, (_^ .rank), (_^ .count), (_^ .loads)]};",
|
|
2855
|
-
" .+ {.o (_^^ .operand _); .me _^; .f (_^^ .finish);",
|
|
2856
|
-
" (f (denum-engine [1, (me .rank), (me .count), (me .loads), (o .rank), (o .count), (o .loads)]))};",
|
|
2857
|
-
" .- {.o (_^^ .operand _); .me _^; .f (_^^ .finish);",
|
|
2858
|
-
" (f (denum-engine [2, (me .rank), (me .count), (me .loads), (o .rank), (o .count), (o .loads)]))};",
|
|
2859
|
-
" .* {.o (_^^ .operand _); .me _^; .f (_^^ .finish);",
|
|
2860
|
-
" (f (denum-engine [3, (me .rank), (me .count), (me .loads), (o .rank), (o .count), (o .loads)]))};",
|
|
2861
|
-
" .promote {.k _; .me _^; .f (_^^ .finish);",
|
|
2862
|
-
" (f (denum-engine [6, (me .rank), (me .count), (me .loads), k]))};",
|
|
2863
|
-
" .opp {.u ((_ = ()) ? {1} : {0}); .me _^; .f (_^^ .finish);",
|
|
2864
|
-
" (u = 1) ? {(f (denum-engine [4, (me .rank), (me .count), (me .loads)]))} : {$!!.unary-observation}};",
|
|
2865
|
-
" .conj {.u ((_ = ()) ? {1} : {0}); .me _^; .f (_^^ .finish);",
|
|
2866
|
-
" (u = 1) ? {(f (denum-engine [5, (me .rank), (me .count), (me .loads)]))} : {$!!.unary-observation}};",
|
|
2867
|
-
" .coordinates {.s ((_ = ()) ? {1} : {0}); .t ((_ = <>) ? {1} : {0}); .me _^;",
|
|
2868
|
-
" ((s + t) = 1) ? {denum-engine [7, (me .rank), (me .count), (me .loads), t]} : {$!!.unary-observation}};",
|
|
2869
|
-
" .observe {.u ((_ = ()) ? {1} : {0}); .me _^;",
|
|
2870
|
-
" (u = 1) ? {denum-engine [7, (me .rank), (me .count), (me .loads), 0]} : {$!!.unary-observation}};",
|
|
2871
|
-
" .signatures {.u ((_ = ()) ? {1} : {0}); .me _^;",
|
|
2872
|
-
" (u = 1) ? {denum-engine [8, (me .rank), (me .count), (me .loads)]} : {$!!.unary-observation}};",
|
|
2873
|
-
" .toText {“Denum(” (_^ .schema) “, C=” (_^ .count) “, W=” (_^ .loads) “)”}",
|
|
2874
|
-
" ]};",
|
|
2875
|
-
".operand {.o _; .r (Denum [(o .rank), (o .count), (o .loads)]); (o = r) ? {o} : {$!!.invalid-denum}};",
|
|
2876
|
-
".finish {.s _; ((s ~ ([].<>)) ? {denum-state s} : {s})};",
|
|
2877
|
-
".Denum {.a _; ((a ~ ([].<>)) ? {(a .#) = 3}) ? {.s (denum-engine [0, (a .0), (a .1), (a .2)]);",
|
|
2878
|
-
" (s ~ ([].<>)) ? {denum-state s} : {$!!.invalid-denum}} : {$!!.invalid-denum}};",
|
|
2879
|
-
"```",
|
|
2880
|
-
"## Construction",
|
|
2881
|
-
"",
|
|
2882
|
-
"A Denum holds its schema, its Count and one load per channel. The rank-0 seed",
|
|
2883
|
-
"has one unsigned channel, and an explicit zero-load D0 is present",
|
|
2884
|
-
"```",
|
|
2885
|
-
"; .z (Denum [0, 0, [0]]);",
|
|
2886
|
-
"; [z.rank, z.schema, z.count, z.loads, z.#, z.##, z.###, “” z]",
|
|
2887
|
-
"# [0, “CD[0]”, 0, [0], 0, 0, 0, “Denum(CD[0], C=0, W=[0])”]",
|
|
2888
|
-
"```",
|
|
2889
|
-
"The loads are Counts, one per channel, and the Count is kept apart from them: a",
|
|
2890
|
-
"Denum may hold loads at Count zero, or a Count over zero loads. A rank beyond 5,",
|
|
2891
|
-
"a negative Count or load, a fractional load, the wrong number of loads and a",
|
|
2892
|
-
"non-list (a bare Count or text for the loads included) are all refused",
|
|
2893
|
-
"```",
|
|
2894
|
-
"; [“” (Denum [2, 7, [3, 2, 0, 1]]), “” (Denum [1, 0, [4, 0]]), “” (Denum [1, 5, [0, 0]])]",
|
|
2895
|
-
"# [“Denum(CD[2], C=7, W=[3, 2, 0, 1])”, “Denum(CD[1], C=0, W=[4, 0])”, “Denum(CD[1], C=5, W=[0, 0])”]",
|
|
2896
|
-
"; [Denum [6, 0, [0]], Denum [1, (0 - 1), [0, 0]], Denum [1, 0, [0, (0 - 1)]], Denum [1, 0, [0, 1.5]], Denum [2, 0, [0, 0, 0]], Denum [0, 0, [0, 0]], Denum 5, Denum [1, 0], Denum [1, 0, [0, 0], 9], Denum [0, 0, 5], Denum [1, 0, 5], Denum [0, 0, “x”]]",
|
|
2897
|
-
"# [$!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum]",
|
|
2898
|
-
"```",
|
|
2899
|
-
"## Signatures",
|
|
2900
|
-
"",
|
|
2901
|
-
"The native spelling has no sign bit: the direction is a bitstring of rank − 1",
|
|
2902
|
-
"bits, and a minus names the opposite signature. Rank 0 has only `e_ε`",
|
|
2903
|
-
"```",
|
|
2904
|
-
"; [(Denum [0, 0, [0]]).signatures (), (Denum [1, 0, [0, 0]]).signatures (), (Denum [2, 0, [0, 0, 0, 0]]).signatures ()]",
|
|
2905
|
-
"# [[“e_ε”], [“e_ε”, “-e_ε”], [“e_0”, “e_1”, “-e_0”, “-e_1”]]",
|
|
2906
|
-
"; (Denum [3, 0, [0, 0, 0, 0, 0, 0, 0, 0]]).signatures ()",
|
|
2907
|
-
"# [“e_00”, “e_01”, “e_10”, “e_11”, “-e_00”, “-e_01”, “-e_10”, “-e_11”]",
|
|
2908
|
-
"; (Denum [4, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]).signatures () .# ",
|
|
2909
|
-
"# 16",
|
|
2910
|
-
"; ((Denum [5, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]).signatures ()) .# ",
|
|
2911
|
-
"# 32",
|
|
2912
|
-
"```",
|
|
2913
|
-
"## Rank 0 and rank 1: Size and signed integers",
|
|
2914
|
-
"",
|
|
2915
|
-
"D0 adds and multiplies unsigned Size, and Counts add and multiply with it. D1",
|
|
2916
|
-
"has the two signatures `e_ε` and `-e_ε`, and the product of two minus signatures",
|
|
2917
|
-
"is the plus signature, `(-e_ε)(-e_ε) = e_ε`, while every load stays a Count",
|
|
2918
|
-
"```",
|
|
2919
|
-
"; .a (Denum [0, 2, [3]]); .b (Denum [0, 5, [4]]);",
|
|
2920
|
-
"; [(a + b).loads, (a + b).count, (a * b).loads, (a * b).count]",
|
|
2921
|
-
"# [[7], 7, [12], 10]",
|
|
2922
|
-
"; .p (Denum [1, 1, [1, 0]]); .m (Denum [1, 1, [0, 1]]);",
|
|
2923
|
-
"; [(m * m).loads, (m * p).loads, (p * m).loads, (p * p).loads]",
|
|
2924
|
-
"# [[1, 0], [0, 1], [0, 1], [1, 0]]",
|
|
2925
|
-
"; [((Denum [1, 1, [0, 2]]) * (Denum [1, 1, [0, 3]])).loads, ((Denum [1, 1, [0, 2]]) * (Denum [1, 1, [0, 3]])).coordinates ()]",
|
|
2926
|
-
"# [[6, 0], [6]]",
|
|
2927
|
-
"```",
|
|
2928
|
-
"Opposite swaps the two channels and subtraction adds the opposite. The balanced",
|
|
2929
|
-
"result observes as zero yet is a present, nonempty Denum with both loads",
|
|
2930
|
-
"```",
|
|
2931
|
-
"; .x (Denum [1, 1, [5, 2]]); .y (Denum [1, 1, [3, 0]]);",
|
|
2932
|
-
"; [x.coordinates (), (x.opp ()).loads, (x - y).loads, (x - y).coordinates (), (x - y).count]",
|
|
2933
|
-
"# [[3], [2, 5], [5, 5], [0], 2]",
|
|
2934
|
-
"; .s (Denum [1, 1, [4, 4]]);",
|
|
2935
|
-
"; [s.coordinates (), s.loads, s.#, s.##, s.###]",
|
|
2936
|
-
"# [[0], [4, 4], 1, 8, 0]",
|
|
2937
|
-
"```",
|
|
2938
|
-
"A D0 has no negative signature, so its opposite is promoted to D1 first",
|
|
2939
|
-
"```",
|
|
2940
|
-
"; ((Denum [0, 3, [4]]).opp ()).loads",
|
|
2941
|
-
"# [0, 4]",
|
|
2942
|
-
"; ((Denum [0, 3, [4]]).opp ()).schema",
|
|
2943
|
-
"# “CD[1]”",
|
|
2944
|
-
"```",
|
|
2945
|
-
"## Operands are Denums only",
|
|
2946
|
-
"",
|
|
2947
|
-
"`+`, `-` and `*` refuse a right operand that is not a Denum, even when it carries",
|
|
2948
|
-
"the same `rank`, `count` and `loads` fields, as `x.#n` refuses a forged source",
|
|
2949
|
-
"```",
|
|
2950
|
-
"; .dp (Denum [1, 1, [1, 0]]); .lookalike [.rank 1; .count 1; .loads [1, 0]];",
|
|
2951
|
-
"; [dp + lookalike, dp - lookalike, dp * lookalike, dp + [1, 1, [1, 0]], dp * 2]",
|
|
2952
|
-
"# [$!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum, $!!.invalid-denum]",
|
|
2953
|
-
"; [(dp + dp).loads, (dp * (dp + dp)).loads, (dp + (dp.opp ())).loads]",
|
|
2954
|
-
"# [[2, 0], [2, 0], [1, 1]]",
|
|
2955
|
-
"```",
|
|
2956
|
-
"## Rank 2: J² = −1 and the four-step cycle",
|
|
2957
|
-
"",
|
|
2958
|
-
"`e_1` is the direction bit of J. Its square is the opposite scalar `-e_0`, and",
|
|
2959
|
-
"the fourth power is back at `e_0`, observed",
|
|
2960
|
-
"```",
|
|
2961
|
-
"; .j (Denum [2, 1, [0, 1, 0, 0]]);",
|
|
2962
|
-
"; [(j * j).loads, (j * j).coordinates (), ((j * j) * (j * j)).loads, ((j * j) * (j * j)).coordinates ()]",
|
|
2963
|
-
"# [[0, 0, 1, 0], [-1, 0], [1, 0, 0, 0], [1, 0]]",
|
|
2964
|
-
"```",
|
|
2965
|
-
"## Rank 3: order matters",
|
|
2966
|
-
"",
|
|
2967
|
-
"With J = `e_01`, I = `e_10` and K = `e_11`, J·I = K and I·J = −K",
|
|
2968
|
-
"```",
|
|
2969
|
-
"; .J (Denum [3, 1, [0, 1, 0, 0, 0, 0, 0, 0]]); .I (Denum [3, 1, [0, 0, 1, 0, 0, 0, 0, 0]]);",
|
|
2970
|
-
"; [(J * I).loads, (I * J).loads]",
|
|
2971
|
-
"# [[0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1]]",
|
|
2972
|
-
"```",
|
|
2973
|
-
"## Rank 4: the octonion associator",
|
|
2974
|
-
"",
|
|
2975
|
-
"`(e_001 e_010) e_100` is `+e_111` and `e_001 (e_010 e_100)` is `-e_111`. The",
|
|
2976
|
-
"Denum keeps the parentheses, so the two groupings differ",
|
|
2977
|
-
"```",
|
|
2978
|
-
"; .o1 (Denum [4, 1, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]); .o2 (Denum [4, 1, [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]); .o4 (Denum [4, 1, [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);",
|
|
2979
|
-
"; [((o1 * o2) * o4).loads, (o1 * (o2 * o4)).loads]",
|
|
2980
|
-
"# [[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]",
|
|
2981
|
-
"; [((o1 * o2) * o4).coordinates () = (o1 * (o2 * o4)).coordinates ()]",
|
|
2982
|
-
"# [()]",
|
|
2983
|
-
"```",
|
|
2984
|
-
"Through rank 3 the product is associative, so the same three directions in the",
|
|
2985
|
-
"quaternions agree",
|
|
2986
|
-
"```",
|
|
2987
|
-
"; [(J * I) * J = (J * (I * J)), ((J * I) * J).coordinates ()]",
|
|
2988
|
-
"# [<>, [0, 0, 1, 0]]",
|
|
2989
|
-
"```",
|
|
2990
|
-
"## Rank 5: sedenion zero divisors",
|
|
2991
|
-
"",
|
|
2992
|
-
"`(e_0001 + e_1010)(e_0100 − e_1111)` observes as zero though neither factor does.",
|
|
2993
|
-
"The product is not an empty Denum: it holds four loads, in cancelling pairs",
|
|
2994
|
-
"```",
|
|
2995
|
-
"; .u (Denum [5, 1, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]); .v (Denum [5, 1, [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]);",
|
|
2996
|
-
"; [u.coordinates (), v.coordinates ()]",
|
|
2997
|
-
"# [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1]]",
|
|
2998
|
-
"; .w (u * v);",
|
|
2999
|
-
"; [w.coordinates (), w.count, w.##, w.###, w.loads]",
|
|
3000
|
-
"# [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1, 4, 0, [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]",
|
|
3001
|
-
"```",
|
|
3002
|
-
"## Promotion across the ladder",
|
|
3003
|
-
"",
|
|
3004
|
-
"Promotion embeds a lower rung into a higher one as the old summand,",
|
|
3005
|
-
"`±e_b ↦ ±e_(0b)`, keeping the Count and every load and starting the new channels",
|
|
3006
|
-
"at zero. D0 goes to the positive scalar, so the new minus channel is empty, and",
|
|
3007
|
-
"the map is path independent",
|
|
3008
|
-
"```",
|
|
3009
|
-
"; .t (Denum [0, 4, [6]]);",
|
|
3010
|
-
"; [(t.promote 1).loads, (t.promote 2).loads, ((t.promote 1).promote 2).loads = (t.promote 2).loads, (t.promote 3).count]",
|
|
3011
|
-
"# [[6, 0], [6, 0, 0, 0], <>, 4]",
|
|
3012
|
-
"; .k (Denum [1, 3, [2, 5]]);",
|
|
3013
|
-
"; [(k.promote 2).loads, (k.promote 3).loads, ((k.promote 2).promote 3).loads = (k.promote 3).loads, k.loads, k.rank]",
|
|
3014
|
-
"# [[2, 0, 5, 0], [2, 0, 0, 0, 5, 0, 0, 0], <>, [2, 5], 1]",
|
|
3015
|
-
"; [((Denum [2, 1, [0, 1, 0, 0]]).promote 3).loads, ((Denum [2, 1, [0, 0, 0, 1]]).promote 3).loads]",
|
|
3016
|
-
"# [[0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0]]",
|
|
3017
|
-
"```",
|
|
3018
|
-
"A lower rank is refused, and so is a rank above 5 or something that is not a",
|
|
3019
|
-
"Count. The source is never changed",
|
|
3020
|
-
"```",
|
|
3021
|
-
"; [(Denum [3, 1, [0, 0, 0, 0, 0, 0, 0, 0]]).promote 2, k.promote 6, k.promote (0 - 1), k.promote “x”]",
|
|
3022
|
-
"# [$!.denum-demotion, $!.denum-rank, $!.denum-rank, $!.denum-rank]",
|
|
3023
|
-
"```",
|
|
3024
|
-
"Mixed ranks promote to the larger one before the operation, and the product keeps",
|
|
3025
|
-
"its operand order. A rank 2 and a rank 3 Denum multiply as two rank 3 Denums",
|
|
3026
|
-
"```",
|
|
3027
|
-
"; .c2 (Denum [2, 2, [0, 1, 0, 0]]); .c3 (Denum [3, 3, [0, 0, 1, 0, 0, 0, 0, 0]]);",
|
|
3028
|
-
"; [(c2 * c3).schema, (c2 * c3).loads, (c3 * c2).loads, (c2 * c3).loads = ((c2.promote 3) * c3).loads, (c2 + c3).schema, (c2 + c3).count]",
|
|
3029
|
-
"# [“CD[3]”, [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1], <>, “CD[3]”, 5]",
|
|
3030
|
-
"; [((c3.promote 5) * (Denum [5, 1, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])).loads = ((c3 * (Denum [3, 1, [0, 1, 0, 0, 0, 0, 0, 0]])).promote 5).loads]",
|
|
3031
|
-
"# [<>]",
|
|
3032
|
-
"```",
|
|
3033
|
-
"## Conjugation",
|
|
3034
|
-
"",
|
|
3035
|
-
"Conjugation fixes the scalar signatures and swaps the two channels of every",
|
|
3036
|
-
"other direction. It keeps the Count and the loads. A product conjugates in",
|
|
3037
|
-
"reverse order, observed",
|
|
3038
|
-
"```",
|
|
3039
|
-
"; .g (Denum [2, 4, [1, 2, 3, 4]]);",
|
|
3040
|
-
"; [(g.conj ()).loads, (g.conj ()).count, (g.conj ()).coordinates (), g.coordinates ()]",
|
|
3041
|
-
"# [[1, 4, 3, 2], 4, [-2, 2], [-2, -2]]",
|
|
3042
|
-
"; [(((J * I).conj ()).coordinates ()) = (((I.conj ()) * (J.conj ())).coordinates ()), ((Denum [0, 1, [4]]).conj ()).loads]",
|
|
3043
|
-
"# [<>, [4]]",
|
|
3044
|
-
"```",
|
|
3045
|
-
"## Count",
|
|
3046
|
-
"",
|
|
3047
|
-
"Count is carried and never derived from the loads. For these Denum operations",
|
|
3048
|
-
"it adds under `+`, multiplies under `*`, and survives the opposite, conjugation",
|
|
3049
|
-
"and promotion. A Count of zero may hold nonzero loads",
|
|
3050
|
-
"```",
|
|
3051
|
-
"; .e (Denum [2, 3, [1, 0, 0, 2]]); .f (Denum [2, 4, [0, 5, 1, 0]]);",
|
|
3052
|
-
"; [(e + f).count, (e * f).count, (e.opp ()).count, (e.conj ()).count, (e.promote 4).count, (e - f).count]",
|
|
3053
|
-
"# [7, 12, 3, 3, 3, 7]",
|
|
3054
|
-
"; .odd (Denum [2, 0, [3, 0, 0, 0]]);",
|
|
3055
|
-
"; [odd.count, odd.##, (odd * f).count, (odd * f).loads, (odd + f).count]",
|
|
3056
|
-
"# [0, 3, 0, [0, 15, 3, 0], 4]",
|
|
3057
|
-
"```",
|
|
3058
|
-
"## Coordinates: signed and unsigned",
|
|
3059
|
-
"",
|
|
3060
|
-
"One method reads the preserved Denum two ways. `d.coordinates ()` is the signed",
|
|
3061
|
-
"coordinate `S_b = W₊,b − W₋,b` and `d.coordinates <>` is the unsigned",
|
|
3062
|
-
"coordinate `U_b = W₊,b + W₋,b`, one integer per direction in the order of the",
|
|
3063
|
-
"channels. They are observations: they never change the Denum, and the Count is",
|
|
3064
|
-
"neither used nor returned. `U` is not `|S|`: opposing loads 3 and 1 give",
|
|
3065
|
-
"`S = 2` and `U = 4`, and the Count 1 below is not a coordinate",
|
|
3066
|
-
"```",
|
|
3067
|
-
"; .q (Denum [2, 1, [3, 2, 1, 4]]);",
|
|
3068
|
-
"; [q.coordinates (), q.coordinates <>, q.observe (), q.count, q.loads]",
|
|
3069
|
-
"# [[2, -2], [4, 6], [2, -2], 1, [3, 2, 1, 4]]",
|
|
3070
|
-
"```",
|
|
3071
|
-
"The Count is independent: the same loads at another Count, even zero, give the",
|
|
3072
|
-
"same coordinates, and a positive Count over zero loads gives zero coordinates",
|
|
3073
|
-
"```",
|
|
3074
|
-
"; .q9 (Denum [2, 9, [3, 2, 1, 4]]); .q0 (Denum [2, 0, [3, 2, 1, 4]]); .qz (Denum [2, 5, [0, 0, 0, 0]]);",
|
|
3075
|
-
"; [q9.coordinates (), q9.coordinates <>, q0.coordinates <>, qz.coordinates (), qz.coordinates <>, qz.count]",
|
|
3076
|
-
"# [[2, -2], [4, 6], [4, 6], [0, 0], [0, 0], 5]",
|
|
3077
|
-
"```",
|
|
3078
|
-
"Rank 0 has one unsigned channel, so both readings are its one load. Higher ranks",
|
|
3079
|
-
"have width 2ⁿ⁻¹",
|
|
3080
|
-
"```",
|
|
3081
|
-
"; .r0 (Denum [0, 2, [3]]); .r1 (Denum [1, 2, [4, 2]]); .r3 (Denum [3, 0, [1, 2, 3, 4, 0, 0, 0, 0]]);",
|
|
3082
|
-
"; [r0.coordinates (), r0.coordinates <>, r1.coordinates (), r1.coordinates <>, r3.coordinates (), r3.coordinates <>]",
|
|
3083
|
-
"# [[3], [3], [2], [6], [1, 2, 3, 4], [1, 2, 3, 4]]",
|
|
3084
|
-
"```",
|
|
3085
|
-
"Balanced opposing loads observe as zero in `S` and not in `U`, and the present",
|
|
3086
|
-
"Denum is still distinct from the missing host",
|
|
3087
|
-
"```",
|
|
3088
|
-
"; .bal (Denum [1, 1, [4, 4]]);",
|
|
3089
|
-
"; [bal.coordinates (), bal.coordinates <>, (Denum [0, 0, [0]]).coordinates <>, [].#0]",
|
|
3090
|
-
"# [[0], [8], [0], ()]",
|
|
3091
|
-
"```",
|
|
3092
|
-
"Only nil and true are arguments. A Count, text, a list, a block or a truthy",
|
|
3093
|
-
"Frame is refused by name, not coerced, and `observe` accepts only nil",
|
|
3094
|
-
"```",
|
|
3095
|
-
"; [q.coordinates 1, q.coordinates 0, q.coordinates “x”, q.coordinates [1], q.coordinates [], q.coordinates {1}, q.observe <>, q.observe 1]",
|
|
3096
|
-
"# [$!!.unary-observation, $!!.unary-observation, $!!.unary-observation, $!!.unary-observation, $!!.unary-observation, $!!.unary-observation, $!!.unary-observation, $!!.unary-observation]",
|
|
3097
|
-
"```",
|
|
3098
|
-
"Rank 4 has eight directions and rank 5 sixteen, each in channel order. Here",
|
|
3099
|
-
"positive loads 1 to 8 (or 1 to 16) sit over negative loads 10 times as large",
|
|
3100
|
-
"```",
|
|
3101
|
-
"; .q4 (Denum [4, 0, [1, 2, 3, 4, 5, 6, 7, 8, 10, 20, 30, 40, 50, 60, 70, 80]]);",
|
|
3102
|
-
"; [q4.coordinates (), q4.coordinates <>]",
|
|
3103
|
-
"# [[-9, -18, -27, -36, -45, -54, -63, -72], [11, 22, 33, 44, 55, 66, 77, 88]]",
|
|
3104
|
-
"; .q5 (Denum [5, 0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]]);",
|
|
3105
|
-
"; [q5.coordinates () .#, q5.coordinates <> .#, (q5.coordinates <>).0, (q5.coordinates <>).15, (q5.coordinates ()).15]",
|
|
3106
|
-
"# [16, 16, 11, 176, -144]",
|
|
3107
|
-
"```",
|
|
3108
|
-
"The seven nonzero directions of rank 4 are the prospective Fano points, and a",
|
|
3109
|
-
"line is the unsigned direction of the product of two of them. Nothing here is a",
|
|
3110
|
-
"table: each direction below is read from the shipped product. The signs of",
|
|
3111
|
-
"`e_001 e_010` and `e_010 e_001` differ and the direction `011` does not",
|
|
3112
|
-
"```",
|
|
3113
|
-
"; .p1 (Denum [4, 1, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]); .p2 (Denum [4, 1, [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]); .p4 (Denum [4, 1, [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);",
|
|
3114
|
-
"; [(p1 * p2).coordinates <>, (p2 * p1).coordinates <>, (p1 * p2).coordinates (), (p2 * p1).coordinates ()]",
|
|
3115
|
-
"# [[0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0, 0, 0]]",
|
|
3116
|
-
"; [(p1 * p4).coordinates <>, (p2 * p4).coordinates <>]",
|
|
3117
|
-
"# [[0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0]]",
|
|
3118
|
-
"```",
|
|
3119
|
-
"Through the same projection the unsigned coordinate of a product is the XOR",
|
|
3120
|
-
"convolution of the unsigned coordinates, and the signed associator at rank 4",
|
|
3121
|
-
"collapses to one direction (`111`) under `<>`",
|
|
3122
|
-
"```",
|
|
3123
|
-
"; [(((o1 * o2) * o4).coordinates <>) = ((o1 * (o2 * o4)).coordinates <>), (((o1 * o2) * o4).coordinates ()) = ((o1 * (o2 * o4)).coordinates ()), ((o1 * o2) * o4).coordinates <>]",
|
|
3124
|
-
"# [<>, (), [0, 0, 0, 0, 0, 0, 0, 1]]",
|
|
3125
|
-
"```",
|
|
3126
|
-
"## Coordinates and the native observers",
|
|
3127
|
-
"",
|
|
3128
|
-
"The two coordinate readings are projections of the same loads that `d.##` and",
|
|
3129
|
-
"`d.###` already report, so the observers cannot drift apart. For every rank the",
|
|
3130
|
-
"unsigned coordinates total the Size, `Σ U_b = d.## = Σ W`. For rank 1 and above",
|
|
3131
|
-
"the signed coordinates total the residual, `Σ S_b = d.###`. At rank 0 the one",
|
|
3132
|
-
"coordinate is `W_ε` in both readings, but the declared residual is 0 by design,",
|
|
3133
|
-
"so `Σ S = W_ε` and `d.### = 0` differ there. The Count is none of these",
|
|
3134
|
-
"```",
|
|
3135
|
-
"; .c0 (Denum [0, 4, [3]]); .c1 (Denum [1, 0, [4, 1]]); .c2 (Denum [2, 1, [3, 2, 1, 4]]);",
|
|
3136
|
-
"; .c0s (c0.coordinates ()); .c1s (c1.coordinates ()); .c2s (c2.coordinates ());",
|
|
3137
|
-
"; .tc0 (c0s.0); .tc1 (c1s.0); .tc2 ((c2s.0) + (c2s.1));",
|
|
3138
|
-
"; [(c0.coordinates <>).##, c0.##, tc0, c0.###, c0.#]",
|
|
3139
|
-
"# [3, 3, 3, 0, 4]",
|
|
3140
|
-
"; [(c1.coordinates <>).##, c1.##, tc1, c1.###, c1.#]",
|
|
3141
|
-
"# [5, 5, 3, 3, 0]",
|
|
3142
|
-
"; [(c2.coordinates <>).##, c2.##, tc2, c2.###, c2.#]",
|
|
3143
|
-
"# [10, 10, 0, 0, 1]",
|
|
3144
|
-
"```",
|
|
3145
|
-
"The same holds when the residual is negative, when loads are empty or balanced,",
|
|
3146
|
-
"and at every higher rank, whatever the Count. Each row is the unsigned total, the",
|
|
3147
|
-
"Size, the signed total, the residual and the Count",
|
|
3148
|
-
"```",
|
|
3149
|
-
"; .n2 (Denum [2, 0, [0, 1, 5, 3]]); .e2 (Denum [2, 7, [0, 0, 0, 0]]); .b3 (Denum [3, 2, [2, 0, 5, 0, 2, 0, 5, 0]]);",
|
|
3150
|
-
"; .n4 (Denum [4, 0, [1, 2, 3, 4, 5, 6, 7, 8, 10, 20, 30, 40, 50, 60, 70, 80]]);",
|
|
3151
|
-
"; .n5 (Denum [5, 3, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]]);",
|
|
3152
|
-
"; .n2s (n2.coordinates ()); .tn2 ((n2s.0) + (n2s.1));",
|
|
3153
|
-
"; .n4s (n4.coordinates ()); .tn4 ((n4s.0) + (n4s.1) + (n4s.2) + (n4s.3) + (n4s.4) + (n4s.5) + (n4s.6) + (n4s.7));",
|
|
3154
|
-
"; .n5s (n5.coordinates ()); .tn5 ((n5s.0) + (n5s.1) + (n5s.2) + (n5s.3) + (n5s.4) + (n5s.5) + (n5s.6) + (n5s.7) + (n5s.8) + (n5s.9) + (n5s.10) + (n5s.11) + (n5s.12) + (n5s.13) + (n5s.14) + (n5s.15));",
|
|
3155
|
-
"; [(n2.coordinates <>).##, n2.##, tn2, n2.###, n2.#]",
|
|
3156
|
-
"# [9, 9, -7, -7, 0]",
|
|
3157
|
-
"; [(e2.coordinates <>).##, e2.##, (e2.coordinates ()).###, e2.###, e2.#]",
|
|
3158
|
-
"# [0, 0, 0, 0, 7]",
|
|
3159
|
-
"; [(b3.coordinates <>).##, b3.##, (b3.coordinates ()).###, b3.###, b3.#]",
|
|
3160
|
-
"# [14, 14, 0, 0, 2]",
|
|
3161
|
-
"; [(n4.coordinates <>).##, n4.##, tn4, n4.###, n4.#]",
|
|
3162
|
-
"# [396, 396, -324, -324, 0]",
|
|
3163
|
-
"; [(n5.coordinates <>).##, n5.##, tn5, n5.###, n5.#]",
|
|
3164
|
-
"# [1496, 1496, -1224, -1224, 3]",
|
|
3165
|
-
"```",
|
|
3166
|
-
"D0 is the only exception, and it is by design. Its residual is 0 though its one",
|
|
3167
|
-
"coordinate is the load, so no rank-0 row may be fixed by changing the residual",
|
|
3168
|
-
"```",
|
|
3169
|
-
"; .z0 (Denum [0, 0, [0]]); .p0 (Denum [0, 0, [9]]);",
|
|
3170
|
-
"; [z0.coordinates (), z0.coordinates <>, z0.##, z0.###, p0.coordinates (), p0.coordinates <>, p0.##, p0.###]",
|
|
3171
|
-
"# [[0], [0], 0, 0, [9], [9], 9, 0]",
|
|
3172
|
-
"```",
|
|
3173
|
-
"",
|
|
3174
|
-
"`x.#n` is the Denum of rung n for n from 0 to 5, and bare `x.#` is still the",
|
|
3175
|
-
"Count. A host answers its Count C, Size s and residual r, so `[1, 2, 3]` has",
|
|
3176
|
-
"C = 3, s = 6 and r = 2. Rank 0 keeps the one load s, rank 1 puts (s+r)/2 on",
|
|
3177
|
-
"`e_ε` and (s−r)/2 on `-e_ε`, which are the Demi's left and right loads, and a",
|
|
3178
|
-
"higher rank puts the same two on `e_0…0` and `-e_0…0`",
|
|
3179
|
-
"```",
|
|
3180
|
-
"; .xs [1, 2, 3];",
|
|
3181
|
-
"; [xs.#, xs.##, xs.###, “” (xs.####)]",
|
|
3182
|
-
"# [3, 6, 2, “Demi(3,4,2)”]",
|
|
3183
|
-
"; [“” (xs.#0), “” (xs.#1), “” (xs.#2)]",
|
|
3184
|
-
"# [“Denum(CD[0], C=3, W=[6])”, “Denum(CD[1], C=3, W=[4, 2])”, “Denum(CD[2], C=3, W=[4, 0, 2, 0])”]",
|
|
3185
|
-
"; [(xs.#3).loads, (xs.#4).##, (xs.#5).schema, (xs.#5).loads .#, (xs.#5).coordinates ()]",
|
|
3186
|
-
"# [[4, 0, 0, 0, 2, 0, 0, 0], 6, “CD[5]”, 32, [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]",
|
|
3187
|
-
"; [xs.#1.loads = xs.####.loads, xs.#1.count = xs.####.count]",
|
|
3188
|
-
"# [<>, <>]",
|
|
3189
|
-
"```",
|
|
3190
|
-
"A router of more than two channels keeps its channel Demi under `.####`, and",
|
|
3191
|
-
"`.#1` is the binary projection of the same three observers, which is what the",
|
|
3192
|
-
"fourth hash derives for a binary router. Both answers are pinned",
|
|
3193
|
-
"```",
|
|
3194
|
-
"; Routers <- './hc/rotor-router.hc';",
|
|
3195
|
-
"; .RotorRouter Routers.RotorRouter;",
|
|
3196
|
-
"; .r3 (RotorRouter [[5, 8], [6], [7]]); .r2 (RotorRouter [[5], [6]]);",
|
|
3197
|
-
"; [r3.#, r3.##, r3.###, “” r3.####, “” r3.#1, “” r3.#2, (r3.#1).count = r3.####.count]",
|
|
3198
|
-
"# [4, 26, 14, “Demi(4,[13, 6, 7])”, “Denum(CD[1], C=4, W=[20, 6])”, “Denum(CD[2], C=4, W=[20, 0, 6, 0])”, <>]",
|
|
3199
|
-
"; [“” r2.####, “” r2.#1, (r2.#1).loads = [(r2.####).left, (r2.####).right]]",
|
|
3200
|
-
"# [“Demi(2,5,6)”, “Denum(CD[1], C=2, W=[5, 6])”, <>]",
|
|
3201
|
-
"```",
|
|
3202
|
-
"It is construction, not promotion. Promotion of an existing Demi-shaped host",
|
|
3203
|
-
"adds nothing, because a host's applications carry no higher signature. Each",
|
|
3204
|
-
"observer is read once, and a Frame without a Count has no Denum, as it has no",
|
|
3205
|
-
"Demi. An empty host, zero Count and nil answer nil at every rank",
|
|
3206
|
-
"```",
|
|
3207
|
-
"; [[].#0, [].#1, [].#5, ().#2, 0.#3]",
|
|
3208
|
-
"# [(), (), (), (), ()]",
|
|
3209
|
-
"; [“”.#1, “” (“a”.#0), ({5 + 3}.#1).loads = ({5 + 3}.####).loads, ({5 + 3}.#1).count]",
|
|
3210
|
-
"# [(), “Denum(CD[0], C=1, W=[1])”, <>, 3]",
|
|
3211
|
-
"```",
|
|
3212
|
-
"Application to a zero Size still counts, so a Denum of zero loads can have a",
|
|
3213
|
-
"positive Count, and it is present. It is not the missing host",
|
|
3214
|
-
"```",
|
|
3215
|
-
"; .zs [0, 0];",
|
|
3216
|
-
"; [“” (zs.#0), “” (zs.#1), zs.#0 = (), (Denum [0, 0, [0]]) = ()]",
|
|
3217
|
-
"# [“Denum(CD[0], C=2, W=[0])”, “Denum(CD[1], C=2, W=[0, 0])”, (), ()]",
|
|
3218
|
-
"```",
|
|
3219
|
-
"A Denum answers the ranked hash by promotion of its own state, at every Count",
|
|
3220
|
-
"including zero, and `$!.denum-demotion` below its rank. Nothing the source",
|
|
3221
|
-
"declares can steer it: a lookalike aggregate with the same fields is an",
|
|
3222
|
-
"ordinary host and is measured like any other",
|
|
3223
|
-
"```",
|
|
3224
|
-
"; .dn (Denum [1, 0, [3, 1]]);",
|
|
3225
|
-
"; [“” (dn.#1), “” (dn.#3), (dn.#2).loads, (dn.#5).count, dn.#0]",
|
|
3226
|
-
"# [“Denum(CD[1], C=0, W=[3, 1])”, “Denum(CD[3], C=0, W=[3, 0, 0, 0, 1, 0, 0, 0])”, [3, 0, 1, 0], 0, $!.denum-demotion]",
|
|
3227
|
-
"; .fake [.rank 1; .count 9; .loads [3, 1]; .# {99}; .## {99}; .### {99}];",
|
|
3228
|
-
"; [“” (fake.#1), “” (fake.#0), fake.#]",
|
|
3229
|
-
"# [“Denum(CD[1], C=99, W=[99, 0])”, “Denum(CD[0], C=99, W=[99])”, 99]",
|
|
3230
|
-
"; [xs.#6, xs.#7, xs.#99]",
|
|
3231
|
-
"# [$!.denum-rank, $!.denum-rank, $!.denum-rank]",
|
|
3232
|
-
"```",
|
|
3233
|
-
"The derived hash of a Denum is the ordinary derived Demi of its three",
|
|
3234
|
-
"observers, which is binary and forgets directions. `d.#n` is the Denum, and its",
|
|
3235
|
-
"algebraic value is an observation, never the return of `#n`",
|
|
3236
|
-
"```",
|
|
3237
|
-
"; [dn.####, “” ((Denum [2, 5, [1, 2, 3, 4]]).####)]",
|
|
3238
|
-
"# [(), “Demi(5,3,7)”]",
|
|
3239
|
-
"```",
|
|
3240
|
-
"`Demi` keeps its own contracts. Its `+`, `-`, `*` and `./` are not Denum",
|
|
3241
|
-
"arithmetic, and a Denum is not a Demi",
|
|
3242
|
-
"```",
|
|
3243
|
-
"; .d (xs.####);",
|
|
3244
|
-
"; [“” (d + 5), “” (d * 2), “” (d ./ 3), xs.#1 + 5]",
|
|
3245
|
-
"# [“Demi(3,4,7)”, “Demi(3,8,4)”, “Demi(3,[2, 2, 2])”, $!!.invalid-denum]",
|
|
3246
|
-
"```",
|
|
3247
|
-
"## Syntax boundaries",
|
|
3248
|
-
"",
|
|
3249
|
-
"The ranked hash is `.#` followed directly by decimal digits. A space ends it,",
|
|
3250
|
-
"and `.##` and `.###` are unchanged. A plain `#` still starts a comment, and the",
|
|
3251
|
-
"lexer cases are pinned in `lib/frames/frame-name.test.ts`",
|
|
3252
|
-
"```",
|
|
3253
|
-
"; [xs.# 2, xs.##, xs.###, xs.##]",
|
|
3254
|
-
"# [6, 6, 2, 6]",
|
|
3255
|
-
"",
|
|
3256
|
-
].join("\n"),
|
|
3257
|
-
],
|
|
3258
2738
|
[
|
|
3259
2739
|
"hc/division.hc",
|
|
3260
2740
|
[
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Frame, FrameCount, FrameString, FrameSymbol, } from "../frames.js";
|
|
2
2
|
// Installs the Demi class that `.####` constructs (011.20).
|
|
3
3
|
import "./demi-prologue.js";
|
|
4
|
-
// Installs the Denum class that the ranked hash `.#n` constructs (007.32).
|
|
5
|
-
import "./denum-prologue.js";
|
|
6
4
|
// Installs the RotorRouter class that list division answers (007.27c).
|
|
7
5
|
import "./router-prologue.js";
|
|
8
6
|
import { EvalPipe, makeSourcePipe } from "./eval-pipe.js";
|
|
@@ -373,7 +373,7 @@ export class FrameArray extends FrameList {
|
|
|
373
373
|
/** A declared Count, Size or residual first; the list's own rule otherwise. */
|
|
374
374
|
sizeFor(key) {
|
|
375
375
|
const failure = this.observationError();
|
|
376
|
-
if (failure && Frame.
|
|
376
|
+
if (failure && Frame.SIZE_OPERATORS.includes(key))
|
|
377
377
|
return failure;
|
|
378
378
|
return this.declaredObservation(key) ?? super.sizeFor(key);
|
|
379
379
|
}
|
|
@@ -177,7 +177,7 @@ export class FrameExpr extends FrameList {
|
|
|
177
177
|
continue;
|
|
178
178
|
}
|
|
179
179
|
if (index === 0 && value.isSymbol() && value.is.address &&
|
|
180
|
-
Frame.
|
|
180
|
+
Frame.SIZE_OPERATORS.includes(value.spelling())) {
|
|
181
181
|
sum = value;
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
@@ -185,7 +185,7 @@ export class FrameExpr extends FrameList {
|
|
|
185
185
|
// is not a receiver, so a leading .## remains an address (#411).
|
|
186
186
|
if (index > 0 && sum.is.void && value.isSymbol() &&
|
|
187
187
|
value.is.address &&
|
|
188
|
-
Frame.
|
|
188
|
+
Frame.SIZE_OPERATORS.includes(value.spelling())) {
|
|
189
189
|
sum = value.called_by(sum);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
@@ -553,7 +553,7 @@ export class FrameScoped extends Frame {
|
|
|
553
553
|
/** Sizes as its term does, `.#`, `.##` and `.###`; anything else is applied. */
|
|
554
554
|
call(argument, parameter = Frame.nil) {
|
|
555
555
|
if (argument.isSymbol() && argument.is.address === true &&
|
|
556
|
-
Frame.
|
|
556
|
+
Frame.SIZE_OPERATORS.includes(argument.spelling())) {
|
|
557
557
|
return this.sizeFor(argument.spelling());
|
|
558
558
|
}
|
|
559
559
|
return this.live().call(argument, parameter);
|
|
@@ -159,7 +159,7 @@ export class FrameLazy extends FrameExpr {
|
|
|
159
159
|
*/
|
|
160
160
|
sizeOperator(argument) {
|
|
161
161
|
if (argument instanceof FrameSymbol && argument.is.address === true &&
|
|
162
|
-
Frame.
|
|
162
|
+
Frame.SIZE_OPERATORS.includes(argument.spelling())) {
|
|
163
163
|
return this.sizeFor(argument.spelling());
|
|
164
164
|
}
|
|
165
165
|
return undefined;
|
|
@@ -145,7 +145,7 @@ export class FrameList extends Frame {
|
|
|
145
145
|
/** Immediate count is unchanged; Size and residual share native child sizes. */
|
|
146
146
|
sizeFor(key) {
|
|
147
147
|
const failure = this.observationError();
|
|
148
|
-
if (failure && Frame.
|
|
148
|
+
if (failure && Frame.SIZE_OPERATORS.includes(key))
|
|
149
149
|
return failure;
|
|
150
150
|
if (key === Frame.kCOUNT) {
|
|
151
151
|
const elements = this.sizeElements();
|
|
@@ -32,14 +32,6 @@ const recognizeName = (symbol, source = "") => {
|
|
|
32
32
|
if (Frame.SIZE_OPERATORS.includes(source + char)) {
|
|
33
33
|
return { disposition: ScanDisposition.Consume };
|
|
34
34
|
}
|
|
35
|
-
// A single hash followed by decimal digits is the ranked hash `.#n`
|
|
36
|
-
// (occurrence/figure 007.32). Only the lone `#` takes digits: `.##2` is
|
|
37
|
-
// `.##` and then the count 2, as before, and `.#2x` is `.#2` then `x`.
|
|
38
|
-
// The spelling is canonical decimal, one name per rung: a zero ends the name,
|
|
39
|
-
// so `.#05` is `.#0` and then the number 5.
|
|
40
|
-
if (/^#(|[1-9][0-9]*)$/.test(source) && /^[0-9]$/.test(char)) {
|
|
41
|
-
return { disposition: ScanDisposition.Consume };
|
|
42
|
-
}
|
|
43
35
|
if (source.startsWith(Frame.kCOUNT)) {
|
|
44
36
|
return { disposition: ScanDisposition.CompleteRedispatch };
|
|
45
37
|
}
|
|
@@ -289,7 +289,7 @@ export class FrameSymbol extends FrameAtom {
|
|
|
289
289
|
// A size operator answers for the receiver itself rather than looking a
|
|
290
290
|
// name up, so the scope a value was read from never answers for it (#411).
|
|
291
291
|
// Only an address is one, since the lexer looks `#` up as the comment.
|
|
292
|
-
if (this.is.address === true && Frame.
|
|
292
|
+
if (this.is.address === true && Frame.SIZE_OPERATORS.includes(this.data)) {
|
|
293
293
|
return context.referent().sizeFor(this.data);
|
|
294
294
|
}
|
|
295
295
|
// A dotted arithmetic operator is the operator itself: `xs ./ 3` is
|