@fraczak/k 6.1.3 → 6.2.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.
Files changed (64) hide show
  1. package/AGENTS.md +4 -4
  2. package/CLAUDE.md +1 -1
  3. package/DOCS/OBJECT_FILE_AND_PATTERN.md +6 -0
  4. package/DOCS/REPL.md +22 -17
  5. package/README.md +6 -5
  6. package/export.mjs +10 -0
  7. package/k-vscode/README.md +10 -1
  8. package/k-vscode/extension.js +273 -0
  9. package/k-vscode/package.json +22 -0
  10. package/k-vscode/syntaxes/k.tmLanguage.json +493 -137
  11. package/k-vscode/test/background-ranges.test.js +50 -0
  12. package/k-vscode/themes/k-contrast-color-theme.json +104 -0
  13. package/package.json +2 -2
  14. package/repl.mjs +43 -2
  15. package/scripts/run-tests.mjs +54 -0
  16. package/{Code-derivation-tests → tests/code-derivation}/codec-witness-pattern.mjs +3 -3
  17. package/{Code-derivation-tests → tests/code-derivation}/convergence-strategy.mjs +1 -1
  18. package/{Code-derivation-tests → tests/code-derivation}/dot.mjs +1 -1
  19. package/{Code-derivation-tests → tests/code-derivation}/filter-syntax.mjs +1 -1
  20. package/{Code-derivation-tests → tests/code-derivation}/index.mjs +1 -1
  21. package/{Code-derivation-tests → tests/code-derivation}/pattern-envelope.mjs +5 -5
  22. package/{Code-derivation-tests → tests/code-derivation}/product.mjs +1 -1
  23. package/{tests.sh → tests/integration.sh} +3 -1
  24. package/{test-fingerprint.mjs → tests/test-fingerprint.mjs} +3 -3
  25. package/{test-hash-fuzz.mjs → tests/test-hash-fuzz.mjs} +1 -1
  26. package/{test-hash-normalization.mjs → tests/test-hash-normalization.mjs} +2 -2
  27. package/{test-ieee-arithmetic.mjs → tests/test-ieee-arithmetic.mjs} +14 -27
  28. package/{test-k-object.mjs → tests/test-k-object.mjs} +8 -8
  29. package/{test-repl.mjs → tests/test-repl.mjs} +22 -4
  30. package/{test.mjs → tests/test.mjs} +1 -1
  31. package/.codex +0 -0
  32. package/DOCS/a.html +0 -398
  33. package/DOCS/dependency-graph.html +0 -140
  34. package/DOCS/dependency-graph.md +0 -144
  35. package/NAT.k~ +0 -452
  36. package/UU/ta.k +0 -1
  37. package/UU/ta.k~ +0 -0
  38. package/UU/tb.k +0 -0
  39. package/UU/tc.k +0 -0
  40. package/a.k +0 -138
  41. package/a.klib +0 -1
  42. package/codecs/BINARY_FORMAT.html +0 -471
  43. package/codecs/POLYMORPHIC_BINARY_FORMAT.html +0 -355
  44. package/core.json +0 -1
  45. package/core.klib +0 -1
  46. package/core.klib~ +0 -0
  47. package/ieee.klib +0 -1
  48. package/k-vscode/package-lock.json +0 -4176
  49. package/kkk.k +0 -197
  50. package/kkk.klib +0 -0
  51. package/kkk.klib~ +0 -0
  52. package/nak.klib +0 -1
  53. package/nak2.klib +0 -1
  54. package/nat.k +0 -10
  55. package/nat2.k +0 -9
  56. package/p.json +0 -5475
  57. package/type_registry/registry.mjs~ +0 -105
  58. package/type_registry/typeParser.jison~ +0 -132
  59. /package/{Code-derivation-tests → tests/code-derivation}/blowup.mjs +0 -0
  60. /package/{Code-derivation-tests → tests/code-derivation}/bnat.mjs +0 -0
  61. /package/{Code-derivation-tests → tests/code-derivation}/loop.mjs +0 -0
  62. /package/{Code-derivation-tests → tests/code-derivation}/nat.mjs +0 -0
  63. /package/{Code-derivation-tests → tests/code-derivation}/not-not.mjs +0 -0
  64. /package/{Code-derivation-tests → tests/code-derivation}/rlz.mjs +0 -0
package/a.k DELETED
@@ -1,138 +0,0 @@
1
- ----- codes -----
2
- $ 2aks = {VtPH "factor", Envk "i"};
3
- $ 2xPW = {PHbG "r", VtPH "x"};
4
- $ 33dY = {VtPH "_x", VtPH "result", VtPH "y"};
5
- $ 6d2A = {NiDZ "if", nh8T "then"};
6
- $ 8MHR = {VtPH "if", 9bLM "then"};
7
- $ 9bLM = < NiDZ "no", NiDZ "yes" >;
8
- $ CuVs = {VtPH "k", VtPH "x"};
9
- $ ERx5 = {Mjus "c", VtPH "x", VtPH "y"};
10
- $ Envk = {VtPH "log", Nws3 "res", VtPH "step", VtPH "x"};
11
- $ EvuD = {VtPH "if", VtPH "then"};
12
- $ F7RN = < NiDZ "+", NiDZ "-" >;
13
- $ FL4i = {nh8T "res_wo_sign", F7RN "sign"};
14
- $ H24y = {VtPH "if", Nws3 "then"};
15
- $ Hj9J = {NiDZ "if", Nws3 "then"};
16
- $ KxW7 = {VtPH "log", VtPH "step", VtPH "x"};
17
- $ Ljf9 = {VtPH "car", PHbG "cdr"};
18
- $ Mjus = < NiDZ "0", NiDZ "1" >;
19
- $ NiDZ = {};
20
- $ Nws3 = < VtPH "+", VtPH "-" >;
21
- $ PHbG = < Ljf9 "cons", NiDZ "nil" >;
22
- $ R7RD = {VtPH "x", VtPH "y"};
23
- $ RLhu = {NiDZ "if", R7RD "then"};
24
- $ RknV = {VtPH "if", PHbG "then"};
25
- $ S5nE = {Nws3 "int", muqD "rat"};
26
- $ TcsE = {muqD "x", muqD "y"};
27
- $ Thzc = {VtPH "r", VtPH "x"};
28
- $ UFVU = {VtPH "_x", Nws3 "k"};
29
- $ Vc85 = {Nws3 "x", Nws3 "y"};
30
- $ VtPH = < VtPH "0", VtPH "1", NiDZ "_" >;
31
- $ WWuP = {muqD "x", Nws3 "y"};
32
- $ YeUu = {VtPH "and", VtPH "if"};
33
- $ YfKH = {VtPH "d", VtPH "n"};
34
- $ ZLDk = {VtPH "step", VtPH "x"};
35
- $ bSFt = {NiDZ "and", VtPH "if", VtPH "then"};
36
- $ dXdV = {9bLM "inOrder", VtPH "x", VtPH "y"};
37
- $ eYsq = {NiDZ "if", VtPH "then"};
38
- $ hJHA = {R7RD "if", VtPH "then"};
39
- $ hPpx = {Nws3 "if", nh8T "then"};
40
- $ muqD = {Nws3 "d", Nws3 "n"};
41
- $ nPgb = {Nws3 "lcm", muqD "x", muqD "y"};
42
- $ nh8T = {Nws3 "div", VtPH "rem"};
43
- $ nhfK = {VtPH "and", VtPH "if", VtPH "then"};
44
- $ prGg = {Vc85 "fib(n),fib(n.1)", VtPH "n"};
45
- $ s7Sd = {Nws3 "res", VtPH "step", VtPH "x"};
46
- $ sqr8 = {VtPH "if", F7RN "then"};
47
- $ uMrJ = {VtPH "if", muqD "then"};
48
- $ yYPm = {VtPH "result", F7RN "sign"};
49
- $ zLbj = {Nws3 "d", nh8T "div", Nws3 "n"};
50
- ----- rels -----
51
- 8jvS = ?(...) 4Uqf mx7B ?<<$NiDZ _, ...> 0, ...>;
52
- TLyi = ?(...) 8jvS 7GtG $VtPH;
53
- 2ezj = ?(...) TLyi 7GtG $VtPH;
54
- BHYs = ?(...) 2ezj 7GtG $VtPH;
55
- XeYK = ?(...) BHYs 7GtG $VtPH;
56
- ycSP = ?(...) XeYK 7GtG $VtPH;
57
- c3fq = ?(...) ycSP 7GtG $VtPH;
58
- ANDv = ?(...) c3fq 7GtG $VtPH;
59
- BASZ = ?(...) ANDv 7GtG $VtPH;
60
- Je6N = ?(...) BASZ 7GtG $VtPH;
61
- PaZn = ?(...) Je6N 7GtG $VtPH;
62
- 8Wzq = ?(...) PaZn 7GtG $VtPH;
63
- 7gmR = ?(...) 8Wzq 7GtG $VtPH;
64
- SCqj = ?<$NiDZ no, $NiDZ yes, ...> </yes |no, /no |yes> $9bLM;
65
- KWT2 = ?(...) {} |yes $9bLM;
66
- 7RTv = ?(...) KWT2 SCqj $9bLM;
67
- L8iN = ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0 () ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0;
68
- tyxZ = ?(...) {} |nil ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0;
69
- C9mM = ?(...) {() car, tyxZ cdr} |cons ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0;
70
- w6w6 = ?{X0 car, <{X0 car, X1 cdr} cons, $NiDZ nil>=X1 cdr, ...} {.car car, .cdr cdr} |cons ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0;
71
- jhbb = ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0 /nil tyxZ ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0;
72
- UY5b = ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0 /cons .car ?(...);
73
- S7xP = ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0 /cons .cdr ?<{(...) car, X0 cdr} cons, $NiDZ nil>=X0;
74
- 4Uqf = ?(...) {} |_ ?<$NiDZ _, ...>;
75
- J6xt = ?(...) |1 ?<(...) 1, ...>;
76
- mx7B = ?(...) |0 ?<(...) 0, ...>;
77
- 7GtG = $VtPH {4YaF x, 4Uqf y} JfKb $VtPH;
78
- ZTFs = $VtPH </_ KWT2, 7RTv> $9bLM;
79
- AkEL = $VtPH {ZTFs /yes if, () then} .then $VtPH;
80
- fKyL = $R7RD {.x 4YaF x, .y y} N8w3 $VtPH;
81
- N8w3 = $R7RD <{.x /0 x, .y mx7B y} N8w3, {.x /1 x, .y J6xt y} N8w3, .y> $VtPH;
82
- 4YaF = $VtPH {() x, 4Uqf r} NbnA $VtPH;
83
- NbnA = $Thzc <{.x /0 x, .r mx7B r} NbnA, {.x /1 x, .r J6xt r} NbnA, .r> $VtPH;
84
- vbhA = $R7RD {.x 4YaF x, .y 4YaF y, KWT2 inOrder} CaAi $9bLM;
85
- CaAi = $dXdV <{.x /0 x, .y /0 y, .inOrder inOrder} CaAi, {.x /1 x, .y /1 y, .inOrder inOrder} CaAi, {.x /0 x, .y /1 y, .inOrder inOrder} CaAi, {.x /1 y, .y /0 x, .inOrder SCqj inOrder} CaAi, {.x </0, /1> if, .inOrder SCqj then} .then, .inOrder> $9bLM;
86
- 6rrB = $R7RD {vbhA /no if, () then} .then $R7RD;
87
- y3WV = $R7RD 6rrB {.x y, .y x} 6rrB $R7RD;
88
- fSRE = $VtPH {4YaF x, tyxZ r} 9hTs $PHbG;
89
- 9hTs = ?{$PHbG r, $VtPH x, ...} <{.x AkEL if, .r then} .then, {.x /0 x, {8jvS car, .r cdr} w6w6 r} 9hTs, {.x /1 x, {TLyi car, .r cdr} w6w6 r} 9hTs> $PHbG;
90
- Ywaf = ?<{<(...) 0, (...) 1, ...> car, X0 cdr} cons, $NiDZ nil>=X0 <S7xP <{UY5b /0 if, S7xP Ywaf mx7B then} .then, {UY5b /1 if, S7xP Ywaf J6xt then} .then>, 4Uqf> $VtPH;
91
- Prn6 = ?<X0 0, ...>=X0 </0 Prn6, ()> ?<X0 0, ...>=X0;
92
- xX22 = $VtPH Prn6 <AkEL 8jvS, ()> $VtPH;
93
- Phke = $VtPH xX22 |+ $Nws3;
94
- xdAf = $Nws3 </+, /-> $VtPH;
95
- JyBD = $Nws3 {7sp2 /+ if, () then} .then $Nws3;
96
- BzLM = $Nws3 {/- if, () then} .then $Nws3;
97
- NxZn = $Nws3 {/+ /0 AkEL if, () then} .then $Nws3;
98
- NKnM = $Nws3 {/- /1 AkEL if, () then} .then $Nws3;
99
- 6VKZ = $Nws3 </+ {4YaF x, 4Uqf y} JfKb |+, NKnM 8jvS Phke, /- {4YaF x, 4Uqf y} 9Cyq |-> $Nws3;
100
- JfKb = $R7RD <{.x /0 x, .y J6xt y} N8w3, {.x /1 x, .y mx7B y} JfKb, .y J6xt> $VtPH;
101
- 7sp2 = $Nws3 <NxZn TLyi |-, /+ {4YaF x, 4Uqf y} 9Cyq |+, /- {4YaF x, 4Uqf y} JfKb |-> $Nws3;
102
- 9Cyq = ?{$VtPH x, $VtPH y, ...} <{.x /1 x, .y mx7B y} N8w3, {.x /0 x, .y J6xt y} 9Cyq> $VtPH;
103
- vvzA = ?(...) {} |0 $Mjus;
104
- nXAf = ?(...) {} |1 $Mjus;
105
- APnt = $Vc85 <{.x /+ 4YaF x, .y /+ 4YaF y, vvzA c} 73G3 4YaF xX22 |+, {.x /- 4YaF x, .y /- 4YaF y, vvzA c} 73G3 4YaF xX22 |-, {.y /- x, .x /+ y} 6rrB {.x 4YaF x, .y 4YaF y, vvzA c} 3kn7 4YaF xX22 |-, {.x /+ 4YaF x, .y /- 4YaF y, vvzA c} 3kn7 4YaF xX22 |+, {.x /- x, .y /+ y} 6rrB {.x 4YaF x, .y 4YaF y, vvzA c} 3kn7 4YaF xX22 |-, {.y /+ 4YaF x, .x /- 4YaF y, vvzA c} 3kn7 4YaF xX22 |+> $Nws3;
106
- 4ZfX = $Nws3 <NxZn, /+ |-, /- |+> $Nws3;
107
- kBAy = $Vc85 {.x x, .y 4ZfX y} APnt $Nws3;
108
- 73G3 = $ERx5 <{.x AkEL if, .y AkEL and, <.c /0 8jvS, TLyi> then} .then, {.x AkEL if, .c /0 and, .y then} .then, {.x y, .y AkEL x, .c c} 73G3, {<.c /0 8jvS, TLyi> x, .y y, .x AkEL vvzA c} 73G3, {.x /0 x, .y /0 y, .c /0 vvzA c} 73G3 mx7B, {.x /0 x, .y /0 y, .c /1 vvzA c} 73G3 J6xt, {.x /0 x, .y /1 y, .c /0 vvzA c} 73G3 J6xt, {.x /0 x, .y /1 y, .c /1 nXAf c} 73G3 mx7B, {.x /1 x, .y /0 y, .c /0 vvzA c} 73G3 J6xt, {.x /1 x, .y /0 y, .c /1 nXAf c} 73G3 mx7B, {.x /1 x, .y /1 y, .c /0 nXAf c} 73G3 mx7B, {.x /1 x, .y /1 y, .c /1 nXAf c} 73G3 J6xt> $VtPH;
109
- 3kn7 = $ERx5 <{.x then, .y AkEL if, .c /0 and} .then, {.x /1 then, .y AkEL if, .c /1 and} .then mx7B, {.x /0 x, .y AkEL y, .c /1 nXAf c} 3kn7 J6xt, {.x /0 x, .y /0 y, .c /0 vvzA c} 3kn7 mx7B, {.x /0 x, .y /0 y, .c /1 nXAf c} 3kn7 J6xt, {.x /0 x, .y /1 y, .c /0 nXAf c} 3kn7 J6xt, {.x /0 x, .y /1 y, .c /1 nXAf c} 3kn7 mx7B, {.x /1 x, .y /0 y, .c /0 vvzA c} 3kn7 J6xt, {.x /1 x, .y /0 y, .c /1 vvzA c} 3kn7 mx7B, {.x /1 x, .y /1 y, .c /0 vvzA c} 3kn7 mx7B, {.x /1 x, .y /1 y, .c /1 nXAf c} 3kn7 J6xt> $VtPH;
110
- NiRD = ?(...) {} |+ $F7RN;
111
- u9uY = ?(...) {} |- $F7RN;
112
- JEEj = $Nws3 </+ NiRD, /- u9uY> $F7RN;
113
- 3PYm = $Vc85 {<{.x /+ if, .y /+ and} NiRD, {.x /- if, .y /- and} NiRD, u9uY> sign, {8jvS result, .x xdAf 4YaF _x, .y xdAf y} 9bpS result} <{.sign /+ if, .result 4YaF Phke then} .then, {.sign /- if, .result 4YaF Phke 4ZfX then} .then> $Nws3;
114
- 9bpS = $33dY <{.y AkEL if, .result then} .then, {.result mx7B result, ._x _x, .y /0 y} 9bpS, {{._x x, .result mx7B y, vvzA c} 73G3 result, ._x _x, .y /1 y} 9bpS> $VtPH;
115
- TPzm = $R7RD _log! <{.y x, .x y} 6rrB .y, {{{.x Phke x, .y Phke y} kBAy /+ x, .y 4YaF mx7B 4YaF y} TPzm x, .y y} TPzm> $VtPH;
116
- Vs6b = $R7RD <{.y x, .x y} 6rrB, ()> Ah93 $VtPH;
117
- Ah93 = $R7RD <{.y /0 if, .x then} .then, {.y x, TPzm y} Ah93> $VtPH;
118
- nB9M = $ZLDk {.x x, .step step, 8jvS log} 5ivr $VtPH;
119
- 5ivr = ?{$VtPH log, $VtPH step, $VtPH x, ...} <{{.step x, .x y} 6rrB if, .log then} .then, {.x x, {.step x, 8jvS y} 6rrB {.x x, 2ezj y} {.x Phke x, .y Phke y} 3PYm xdAf step, .log Phke 6VKZ xdAf log} 5ivr> $VtPH;
120
- MTKW = $CuVs {.x 4YaF _x, .k Phke k} au4T 4YaF $VtPH;
121
- au4T = ?{<X0 0, ...>=X0 _x, $Nws3 k, ...} <{.k NxZn if, ._x then} .then, {._x mx7B _x, .k 7sp2 k} au4T> ?<X0 0, ...>=X0;
122
- Bs2e = $Vc85 {<{.x /+ if, .y JEEj then} .then, {.x /- if, .y 4ZfX JEEj then} .then> sign, {.x xdAf x, .y xdAf step, 8jvS Phke res} 8Dwz res_wo_sign} <{.sign /+ if, {.res_wo_sign .div div, .res_wo_sign .rem rem} then} .then, {.res_wo_sign .div 4ZfX div, .res_wo_sign .rem rem}> $nh8T;
123
- 8Dwz = ?{$Nws3 res, $VtPH step, $VtPH x, ...} {.x x, .step step, .res res, {.x x, .step step} nB9M log} <{.log Phke NxZn if, {.res div, .x rem} then} .then, {{TLyi x, .log Phke 7sp2 xdAf k} MTKW factor, () i} {{.i .x Phke x, {.i .step Phke x, .factor Phke y} 3PYm y} kBAy xdAf x, .i .step step, {.i .res x, .factor Phke y} APnt res} 8Dwz> $nh8T;
124
- GSLa = $R7RD {{.x Phke x, .y Phke y} 3PYm x, Vs6b Phke y} Bs2e .div xdAf $VtPH;
125
- FaWv = $Nws3 <NxZn TLyi Phke, /+ Phke {7sp2 FaWv x, () y} 3PYm> $Nws3;
126
- HZYv = ?{$Vc85"fib(n),fib(n.1)", $VtPH n, ...} <{.n Phke 7sp2 /+ n, ."fib(n),fib(n.1)" {APnt x, .x y}"fib(n),fib(n.1)"} HZYv, ."fib(n),fib(n.1)"> $Vc85;
127
- aUJp = $VtPH {() n, {TLyi Phke x, 8jvS Phke y}"fib(n),fib(n.1)"} HZYv .x $Nws3;
128
- sghj = $YfKH {.n Phke n, .d Phke d} 2zFi $muqD;
129
- 2zFi = $muqD <{.d /- if, {.n 4ZfX n, .d 4ZfX d} then} .then, ()> {() x, {.n xdAf x, .d xdAf y} Vs6b Phke y} {{.x .n x, .y y} Bs2e .div n, {.x .d x, .y y} Bs2e .div d} $muqD;
130
- Jn92 = $TcsE {.x x, .y y, {.x .d xdAf x, .y .d xdAf y} GSLa Phke lcm} {{{.x .n x, {.lcm x, .x .d y} Bs2e .div y} 3PYm x, {.y .n x, {.lcm x, .y .d y} Bs2e .div y} 3PYm y} APnt n, .lcm d} 2zFi $muqD;
131
- 2Uyd = $TcsE {{.x .n x, .y .n y} 3PYm n, {.x .d x, .y .d y} 3PYm d} 2zFi $muqD;
132
- uRTk = $TcsE {.x x, .y {.n 4ZfX n, .d d} y} Jn92 $muqD;
133
- FtdC = $muqD {.d n, .n d} 2zFi $muqD;
134
- MH4q = $TcsE {.x x, .y FtdC y} 2Uyd $muqD;
135
- 8jRf = $muqD {.n n, .d d, {.n x, .d y} Bs2e div} {.div .div int, {.div .rem Phke n, .d d} rat} $S5nE;
136
-
137
- ()
138
-