@fraczak/k 6.1.3 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -4
- package/CLAUDE.md +1 -1
- package/DOCS/KIR_SPECIALIZATION_DESIGN.md +11 -2
- package/DOCS/KVM_EXECUTION_MODEL.md +413 -0
- package/DOCS/OBJECT_FILE_AND_PATTERN.md +6 -0
- package/DOCS/REPL.md +22 -17
- package/{NAT.k~ → Examples/arithmetics.k} +1 -1
- package/Examples/bnat.k +291 -0
- package/Examples/byte.k +67 -0
- package/Examples/code.k +44 -0
- package/Examples/esc.k +9 -0
- package/Examples/ieee.k +15766 -0
- package/Examples/list.k +7 -0
- package/Examples/nat.k +12 -0
- package/Examples/vhdl_to_k.k +50 -0
- package/README.md +14 -5
- package/backend-api.mjs +12 -0
- package/codecs/runtime/codec.mjs +1 -0
- package/export.mjs +10 -0
- package/k-vscode/README.md +10 -1
- package/k-vscode/extension.js +273 -0
- package/k-vscode/package.json +22 -0
- package/k-vscode/syntaxes/k.tmLanguage.json +493 -137
- package/k-vscode/test/background-ranges.test.js +50 -0
- package/k-vscode/themes/k-contrast-color-theme.json +104 -0
- package/kvm.mjs +523 -0
- package/package.json +4 -3
- package/repl.mjs +43 -2
- package/run.mjs +1 -1
- package/scripts/run-tests.mjs +55 -0
- package/tests/README.md +35 -0
- package/{Code-derivation-tests → tests/code-derivation}/codec-witness-pattern.mjs +4 -4
- package/{Code-derivation-tests → tests/code-derivation}/convergence-strategy.mjs +1 -1
- package/{Code-derivation-tests → tests/code-derivation}/dot.mjs +1 -1
- package/{Code-derivation-tests → tests/code-derivation}/filter-syntax.mjs +1 -1
- package/{Code-derivation-tests → tests/code-derivation}/index.mjs +1 -1
- package/{Code-derivation-tests → tests/code-derivation}/pattern-envelope.mjs +5 -5
- package/{Code-derivation-tests → tests/code-derivation}/product.mjs +1 -1
- package/{tests.sh → tests/integration.sh} +11 -6
- package/{test-fingerprint.mjs → tests/test-fingerprint.mjs} +3 -3
- package/{test-hash-fuzz.mjs → tests/test-hash-fuzz.mjs} +1 -1
- package/{test-hash-normalization.mjs → tests/test-hash-normalization.mjs} +2 -2
- package/{test-ieee-arithmetic.mjs → tests/test-ieee-arithmetic.mjs} +14 -27
- package/{test-k-object.mjs → tests/test-k-object.mjs} +8 -8
- package/tests/test-kvm.mjs +163 -0
- package/{test-repl.mjs → tests/test-repl.mjs} +22 -4
- package/{test.mjs → tests/test.mjs} +1 -1
- package/.codex +0 -0
- package/DOCS/a.html +0 -398
- package/DOCS/dependency-graph.html +0 -140
- package/DOCS/dependency-graph.md +0 -144
- package/UU/ta.k +0 -1
- package/UU/ta.k~ +0 -0
- package/UU/tb.k +0 -0
- package/UU/tc.k +0 -0
- package/a.k +0 -138
- package/a.klib +0 -1
- package/codecs/BINARY_FORMAT.html +0 -471
- package/codecs/POLYMORPHIC_BINARY_FORMAT.html +0 -355
- package/core.json +0 -1
- package/core.klib +0 -1
- package/core.klib~ +0 -0
- package/ieee.klib +0 -1
- package/k-vscode/package-lock.json +0 -4176
- package/kkk.k +0 -197
- package/kkk.klib +0 -0
- package/kkk.klib~ +0 -0
- package/nak.klib +0 -1
- package/nak2.klib +0 -1
- package/nat.k +0 -10
- package/nat2.k +0 -9
- package/p.json +0 -5475
- package/type_registry/registry.mjs~ +0 -105
- package/type_registry/typeParser.jison~ +0 -132
- /package/{Code-derivation-tests → tests/code-derivation}/blowup.mjs +0 -0
- /package/{Code-derivation-tests → tests/code-derivation}/bnat.mjs +0 -0
- /package/{Code-derivation-tests → tests/code-derivation}/loop.mjs +0 -0
- /package/{Code-derivation-tests → tests/code-derivation}/nat.mjs +0 -0
- /package/{Code-derivation-tests → tests/code-derivation}/not-not.mjs +0 -0
- /package/{Code-derivation-tests → tests/code-derivation}/rlz.mjs +0 -0
package/DOCS/dependency-graph.md
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# Project Dependency Graph
|
|
2
|
-
|
|
3
|
-
_Auto-generated by scripts/generate-dependency-graph.mjs._
|
|
4
|
-
|
|
5
|
-
```mermaid
|
|
6
|
-
graph TD
|
|
7
|
-
classDef default fill:#fff,stroke:#333,stroke-width:2px,color:#000;
|
|
8
|
-
|
|
9
|
-
Graph_mjs["Graph.mjs (1.9 KB)<br/>██"]
|
|
10
|
-
TypeGraph_mjs["TypeGraph.mjs (1.1 KB)<br/>█"]
|
|
11
|
-
TypePatternGraph_mjs["TypePatternGraph.mjs (8.0 KB)<br/>████████"]
|
|
12
|
-
Value_mjs["Value.mjs (5.4 KB)<br/>█████"]
|
|
13
|
-
augmentation_mjs["augmentation.mjs (6.9 KB)<br/>███████"]
|
|
14
|
-
codecs_example_pipeline_mjs["codecs/example-pipeline.mjs (5.1 KB)<br/>█████"]
|
|
15
|
-
codecs_ieee_mjs["codecs/ieee.mjs (4.3 KB)<br/>████"]
|
|
16
|
-
codecs_int_mjs["codecs/int.mjs (3.5 KB)<br/>████"]
|
|
17
|
-
codecs_json_codec_mjs["codecs/json-codec.mjs (6.2 KB)<br/>██████"]
|
|
18
|
-
codecs_json_mjs["codecs/json.mjs (1.5 KB)<br/>██"]
|
|
19
|
-
codecs_k_parse_mjs["codecs/k-parse.mjs (3.0 KB)<br/>███"]
|
|
20
|
-
codecs_k_print_mjs["codecs/k-print.mjs (1.5 KB)<br/>██"]
|
|
21
|
-
codecs_runtime_codec_mjs["codecs/runtime/codec.mjs (25.7 KB)<br/>████████████████████"]
|
|
22
|
-
codecs_runtime_ieee_pattern_mjs["codecs/runtime/ieee-pattern.mjs (1.1 KB)<br/>█"]
|
|
23
|
-
codecs_runtime_pattern_json_mjs["codecs/runtime/pattern-json.mjs (3.5 KB)<br/>███"]
|
|
24
|
-
codecs_runtime_prefix_codec_mjs["codecs/runtime/prefix-codec.mjs (13.7 KB)<br/>██████████████"]
|
|
25
|
-
codecs_runtime_show_value_mjs["codecs/runtime/show-value.mjs (2.1 KB)<br/>██"]
|
|
26
|
-
codecs_runtime_test_codec_mjs["codecs/runtime/test-codec.mjs (3.0 KB)<br/>███"]
|
|
27
|
-
codecs_runtime_typeFromValue_mjs["codecs/runtime/typeFromValue.mjs (0.9 KB)<br/>█"]
|
|
28
|
-
codecs_runtime_unicode_string_mjs["codecs/runtime/unicode-string.mjs (7.5 KB)<br/>████████"]
|
|
29
|
-
codecs_show_mjs["codecs/show.mjs (1.5 KB)<br/>██"]
|
|
30
|
-
codecs_string_codec_mjs["codecs/string-codec.mjs (4.5 KB)<br/>█████"]
|
|
31
|
-
codecs_unit_mjs["codecs/unit.mjs (1.6 KB)<br/>██"]
|
|
32
|
-
codecs_utf16_mjs["codecs/utf16.mjs (2.2 KB)<br/>██"]
|
|
33
|
-
codecs_utf8_mjs["codecs/utf8.mjs (1.3 KB)<br/>█"]
|
|
34
|
-
codes_mjs["codes.mjs (9.9 KB)<br/>██████████"]
|
|
35
|
-
compiler_mjs["compiler.mjs (3.9 KB)<br/>████"]
|
|
36
|
-
convergence_mjs["convergence.mjs (6.5 KB)<br/>██████"]
|
|
37
|
-
export_mjs["export.mjs (5.2 KB)<br/>█████"]
|
|
38
|
-
hash_mjs["hash.mjs (1.1 KB)<br/>█"]
|
|
39
|
-
index_mjs["index.mjs (1.9 KB)<br/>██"]
|
|
40
|
-
k_mjs["k.mjs (2.7 KB)<br/>███"]
|
|
41
|
-
object_mjs["object.mjs (26.3 KB)<br/>████████████████████"]
|
|
42
|
-
pretty_mjs["pretty.mjs (5.6 KB)<br/>██████"]
|
|
43
|
-
repl_mjs["repl.mjs (29.3 KB)<br/>████████████████████"]
|
|
44
|
-
run_mjs["run.mjs (14.4 KB)<br/>██████████████"]
|
|
45
|
-
symbol_table_mjs["symbol-table.mjs (2.7 KB)<br/>███"]
|
|
46
|
-
typing_mjs["typing.mjs (4.9 KB)<br/>█████"]
|
|
47
|
-
unification_mjs["unification.mjs (5.4 KB)<br/>█████"]
|
|
48
|
-
valueIO_mjs["valueIO.mjs (1.8 KB)<br/>██"]
|
|
49
|
-
|
|
50
|
-
TypePatternGraph_mjs --> Graph_mjs
|
|
51
|
-
TypePatternGraph_mjs --> unification_mjs
|
|
52
|
-
TypePatternGraph_mjs --> TypeGraph_mjs
|
|
53
|
-
augmentation_mjs --> codes_mjs
|
|
54
|
-
codecs_example_pipeline_mjs --> codecs_runtime_codec_mjs
|
|
55
|
-
codecs_example_pipeline_mjs --> codecs_runtime_prefix_codec_mjs
|
|
56
|
-
codecs_example_pipeline_mjs --> codecs_runtime_pattern_json_mjs
|
|
57
|
-
codecs_example_pipeline_mjs --> Value_mjs
|
|
58
|
-
codecs_example_pipeline_mjs --> hash_mjs
|
|
59
|
-
codecs_ieee_mjs --> Value_mjs
|
|
60
|
-
codecs_ieee_mjs --> codecs_runtime_prefix_codec_mjs
|
|
61
|
-
codecs_ieee_mjs --> codecs_runtime_ieee_pattern_mjs
|
|
62
|
-
codecs_int_mjs --> Value_mjs
|
|
63
|
-
codecs_int_mjs --> codecs_runtime_prefix_codec_mjs
|
|
64
|
-
codecs_json_codec_mjs --> Value_mjs
|
|
65
|
-
codecs_json_codec_mjs --> codecs_string_codec_mjs
|
|
66
|
-
codecs_json_codec_mjs --> codecs_runtime_ieee_pattern_mjs
|
|
67
|
-
codecs_json_mjs --> codecs_runtime_prefix_codec_mjs
|
|
68
|
-
codecs_json_mjs --> codecs_json_codec_mjs
|
|
69
|
-
codecs_k_parse_mjs --> index_mjs
|
|
70
|
-
codecs_k_parse_mjs --> valueIO_mjs
|
|
71
|
-
codecs_k_parse_mjs --> codecs_runtime_codec_mjs
|
|
72
|
-
codecs_k_parse_mjs --> codecs_runtime_pattern_json_mjs
|
|
73
|
-
codecs_k_parse_mjs --> codecs_runtime_prefix_codec_mjs
|
|
74
|
-
codecs_k_print_mjs --> codecs_runtime_prefix_codec_mjs
|
|
75
|
-
codecs_runtime_codec_mjs --> Value_mjs
|
|
76
|
-
codecs_runtime_codec_mjs --> TypePatternGraph_mjs
|
|
77
|
-
codecs_runtime_codec_mjs --> typing_mjs
|
|
78
|
-
codecs_runtime_codec_mjs --> codes_mjs
|
|
79
|
-
codecs_runtime_codec_mjs --> codecs_runtime_pattern_json_mjs
|
|
80
|
-
codecs_runtime_ieee_pattern_mjs --> codes_mjs
|
|
81
|
-
codecs_runtime_ieee_pattern_mjs --> codecs_runtime_codec_mjs
|
|
82
|
-
codecs_runtime_ieee_pattern_mjs --> codecs_runtime_pattern_json_mjs
|
|
83
|
-
codecs_runtime_prefix_codec_mjs --> Value_mjs
|
|
84
|
-
codecs_runtime_prefix_codec_mjs --> codecs_runtime_codec_mjs
|
|
85
|
-
codecs_runtime_prefix_codec_mjs --> codecs_runtime_pattern_json_mjs
|
|
86
|
-
codecs_runtime_prefix_codec_mjs --> codecs_runtime_unicode_string_mjs
|
|
87
|
-
codecs_runtime_show_value_mjs --> Value_mjs
|
|
88
|
-
codecs_runtime_test_codec_mjs --> codecs_runtime_codec_mjs
|
|
89
|
-
codecs_runtime_test_codec_mjs --> codecs_runtime_prefix_codec_mjs
|
|
90
|
-
codecs_runtime_test_codec_mjs --> codecs_runtime_pattern_json_mjs
|
|
91
|
-
codecs_runtime_test_codec_mjs --> Value_mjs
|
|
92
|
-
codecs_runtime_test_codec_mjs --> hash_mjs
|
|
93
|
-
codecs_runtime_typeFromValue_mjs --> Value_mjs
|
|
94
|
-
codecs_runtime_unicode_string_mjs --> Value_mjs
|
|
95
|
-
codecs_show_mjs --> codecs_runtime_prefix_codec_mjs
|
|
96
|
-
codecs_show_mjs --> codecs_runtime_show_value_mjs
|
|
97
|
-
codecs_string_codec_mjs --> codecs_runtime_codec_mjs
|
|
98
|
-
codecs_string_codec_mjs --> codecs_runtime_prefix_codec_mjs
|
|
99
|
-
codecs_string_codec_mjs --> codecs_runtime_pattern_json_mjs
|
|
100
|
-
codecs_string_codec_mjs --> codecs_runtime_unicode_string_mjs
|
|
101
|
-
codecs_unit_mjs --> Value_mjs
|
|
102
|
-
codecs_unit_mjs --> codecs_runtime_prefix_codec_mjs
|
|
103
|
-
codecs_utf16_mjs --> codecs_string_codec_mjs
|
|
104
|
-
codecs_utf8_mjs --> codecs_string_codec_mjs
|
|
105
|
-
codes_mjs --> hash_mjs
|
|
106
|
-
compiler_mjs --> hash_mjs
|
|
107
|
-
compiler_mjs --> TypePatternGraph_mjs
|
|
108
|
-
compiler_mjs --> Graph_mjs
|
|
109
|
-
compiler_mjs --> codes_mjs
|
|
110
|
-
compiler_mjs --> augmentation_mjs
|
|
111
|
-
compiler_mjs --> export_mjs
|
|
112
|
-
compiler_mjs --> convergence_mjs
|
|
113
|
-
convergence_mjs --> pretty_mjs
|
|
114
|
-
convergence_mjs --> typing_mjs
|
|
115
|
-
export_mjs --> hash_mjs
|
|
116
|
-
export_mjs --> pretty_mjs
|
|
117
|
-
index_mjs --> Value_mjs
|
|
118
|
-
index_mjs --> valueIO_mjs
|
|
119
|
-
index_mjs --> compiler_mjs
|
|
120
|
-
index_mjs --> run_mjs
|
|
121
|
-
index_mjs --> codes_mjs
|
|
122
|
-
k_mjs --> index_mjs
|
|
123
|
-
k_mjs --> codecs_runtime_prefix_codec_mjs
|
|
124
|
-
k_mjs --> object_mjs
|
|
125
|
-
object_mjs --> index_mjs
|
|
126
|
-
object_mjs --> run_mjs
|
|
127
|
-
object_mjs --> codes_mjs
|
|
128
|
-
object_mjs --> TypePatternGraph_mjs
|
|
129
|
-
object_mjs --> pretty_mjs
|
|
130
|
-
pretty_mjs --> TypePatternGraph_mjs
|
|
131
|
-
repl_mjs --> index_mjs
|
|
132
|
-
repl_mjs --> run_mjs
|
|
133
|
-
repl_mjs --> codes_mjs
|
|
134
|
-
repl_mjs --> Value_mjs
|
|
135
|
-
repl_mjs --> pretty_mjs
|
|
136
|
-
repl_mjs --> object_mjs
|
|
137
|
-
repl_mjs --> codecs_runtime_show_value_mjs
|
|
138
|
-
run_mjs --> Value_mjs
|
|
139
|
-
run_mjs --> codecs_runtime_codec_mjs
|
|
140
|
-
run_mjs --> codecs_runtime_pattern_json_mjs
|
|
141
|
-
symbol_table_mjs --> hash_mjs
|
|
142
|
-
typing_mjs --> TypePatternGraph_mjs
|
|
143
|
-
valueIO_mjs --> Value_mjs
|
|
144
|
-
```
|
package/UU/ta.k
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$bit
|
package/UU/ta.k~
DELETED
|
File without changes
|
package/UU/tb.k
DELETED
|
File without changes
|
package/UU/tc.k
DELETED
|
File without changes
|
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
|
-
|