firefly-compiler 0.5.35 → 0.5.37
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/.hintrc +4 -4
- package/.vscode/settings.json +4 -4
- package/bin/Release.ff +157 -154
- package/bin/firefly.mjs +1 -1
- package/compiler/Builder.ff +275 -277
- package/compiler/Compiler.ff +234 -233
- package/compiler/Dependencies.ff +186 -187
- package/compiler/DependencyLock.ff +17 -17
- package/compiler/Deriver.ff +23 -31
- package/compiler/Dictionaries.ff +1 -1
- package/compiler/Inference.ff +43 -20
- package/compiler/JsEmitter.ff +1437 -1282
- package/compiler/LspHook.ff +202 -202
- package/compiler/Main.ff +25 -24
- package/compiler/ModuleCache.ff +178 -178
- package/compiler/Parser.ff +36 -109
- package/compiler/Resolver.ff +5 -8
- package/compiler/Substitution.ff +1 -1
- package/compiler/Syntax.ff +1 -16
- package/compiler/Token.ff +9 -0
- package/compiler/Tokenizer.ff +4 -0
- package/compiler/Workspace.ff +88 -88
- package/core/.firefly/include/package.json +5 -5
- package/core/.firefly/package.ff +2 -2
- package/core/Any.ff +26 -30
- package/core/Array.ff +298 -265
- package/core/Atomic.ff +63 -64
- package/core/Box.ff +7 -7
- package/core/BrowserSystem.ff +40 -40
- package/core/Buffer.ff +185 -152
- package/core/BuildSystem.ff +156 -148
- package/core/Channel.ff +95 -92
- package/core/Char.ff +3 -2
- package/core/Core.ff +16 -23
- package/core/Crypto.ff +94 -96
- package/core/Equal.ff +41 -36
- package/core/Error.ff +15 -10
- package/core/FileHandle.ff +45 -37
- package/core/Float.ff +176 -200
- package/core/HttpClient.ff +142 -148
- package/core/Instant.ff +6 -8
- package/core/Int.ff +40 -24
- package/core/IntMap.ff +61 -39
- package/core/Js.ff +305 -0
- package/core/JsSystem.ff +135 -114
- package/core/JsValue.ff +303 -159
- package/core/Json.ff +423 -443
- package/core/List.ff +482 -486
- package/core/Lock.ff +108 -144
- package/core/Log.ff +25 -14
- package/core/NodeSystem.ff +198 -191
- package/core/Ordering.ff +160 -161
- package/core/Path.ff +377 -409
- package/core/Queue.ff +90 -0
- package/core/Random.ff +140 -134
- package/core/RbMap.ff +216 -216
- package/core/Serializable.ff +16 -13
- package/core/Show.ff +44 -43
- package/core/SourceLocation.ff +68 -68
- package/core/Stream.ff +1 -1
- package/core/String.ff +224 -202
- package/core/StringMap.ff +58 -36
- package/core/Task.ff +165 -149
- package/experimental/benchmarks/ListGrab.ff +23 -23
- package/experimental/benchmarks/ListGrab.java +55 -55
- package/experimental/benchmarks/Pyrotek45.ff +30 -30
- package/experimental/benchmarks/Pyrotek45.java +64 -64
- package/experimental/bidirectional/Bidi.ff +88 -88
- package/experimental/lines/Main.ff +40 -0
- package/experimental/random/Index.ff +53 -53
- package/experimental/random/Process.ff +120 -120
- package/experimental/random/RunLength.ff +65 -65
- package/experimental/random/Scrape.ff +51 -51
- package/experimental/random/Symbols.ff +73 -73
- package/experimental/random/Tensor.ff +52 -52
- package/experimental/random/Units.ff +36 -36
- package/experimental/s3/S3TestAuthorizationHeader.ff +39 -39
- package/experimental/s3/S3TestPut.ff +16 -16
- package/experimental/tests/TestJson.ff +26 -26
- package/firefly.sh +0 -0
- package/fireflysite/.firefly/package.ff +4 -4
- package/fireflysite/CommunityOverview.ff +20 -20
- package/fireflysite/CountingButtonDemo.ff +58 -58
- package/fireflysite/DocumentParser.ff +325 -331
- package/fireflysite/ExamplesOverview.ff +40 -40
- package/fireflysite/FrontPage.ff +344 -344
- package/fireflysite/GettingStarted.ff +45 -45
- package/fireflysite/Guide.ff +456 -456
- package/fireflysite/Main.ff +163 -152
- package/fireflysite/MatchingPasswordsDemo.ff +82 -82
- package/fireflysite/PackagesOverview.ff +49 -49
- package/fireflysite/PostgresqlDemo.ff +34 -34
- package/fireflysite/ReferenceAll.ff +18 -18
- package/fireflysite/ReferenceIntroduction.ff +11 -11
- package/fireflysite/Styles.ff +567 -567
- package/fireflysite/Test.ff +121 -62
- package/fireflysite/assets/markdown/reference/BaseTypes.md +209 -209
- package/fireflysite/assets/markdown/reference/EmittedJavascript.md +65 -65
- package/fireflysite/assets/markdown/reference/Exceptions.md +101 -101
- package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +364 -364
- package/fireflysite/assets/markdown/reference/JavascriptInterop.md +235 -172
- package/fireflysite/assets/markdown/reference/ModulesAndPackages.md +162 -162
- package/fireflysite/assets/markdown/reference/OldStructuredConcurrency.md +48 -48
- package/fireflysite/assets/markdown/reference/PatternMatching.md +224 -224
- package/fireflysite/assets/markdown/reference/StatementsAndExpressions.md +86 -86
- package/fireflysite/assets/markdown/reference/StructuredConcurrency.md +99 -99
- package/fireflysite/assets/markdown/reference/TraitsAndInstances.md +100 -100
- package/fireflysite/assets/markdown/reference/UserDefinedTypes.md +184 -184
- package/fireflysite/assets/markdown/scratch/ControlFlow.md +136 -136
- package/fireflysite/assets/markdown/scratch/Toc.md +40 -40
- package/lsp/.firefly/package.ff +1 -1
- package/lsp/CompletionHandler.ff +827 -827
- package/lsp/Handler.ff +714 -714
- package/lsp/HoverHandler.ff +79 -79
- package/lsp/LanguageServer.ff +272 -272
- package/lsp/SignatureHelpHandler.ff +55 -55
- package/lsp/SymbolHandler.ff +181 -181
- package/lsp/TestReferences.ff +17 -17
- package/lsp/TestReferencesCase.ff +7 -7
- package/lsp/stderr.txt +1 -1
- package/lsp/stdout.txt +34 -34
- package/lux/.firefly/package.ff +1 -1
- package/lux/Css.ff +648 -648
- package/lux/CssTest.ff +48 -48
- package/lux/Lux.ff +608 -617
- package/lux/LuxEvent.ff +79 -116
- package/lux/Main.ff +123 -123
- package/lux/Main2.ff +143 -143
- package/lux/TestDry.ff +28 -28
- package/output/js/ff/compiler/Builder.mjs +72 -71
- package/output/js/ff/compiler/Compiler.mjs +19 -13
- package/output/js/ff/compiler/Dependencies.mjs +8 -7
- package/output/js/ff/compiler/DependencyLock.mjs +6 -4
- package/output/js/ff/compiler/Deriver.mjs +26 -24
- package/output/js/ff/compiler/Dictionaries.mjs +14 -18
- package/output/js/ff/compiler/Environment.mjs +6 -4
- package/output/js/ff/compiler/Inference.mjs +238 -164
- package/output/js/ff/compiler/JsEmitter.mjs +1160 -350
- package/output/js/ff/compiler/JsImporter.mjs +20 -18
- package/output/js/ff/compiler/LspHook.mjs +12 -10
- package/output/js/ff/compiler/Main.mjs +61 -41
- package/output/js/ff/compiler/ModuleCache.mjs +10 -8
- package/output/js/ff/compiler/Parser.mjs +153 -669
- package/output/js/ff/compiler/Patterns.mjs +12 -10
- package/output/js/ff/compiler/Resolver.mjs +52 -78
- package/output/js/ff/compiler/Substitution.mjs +12 -16
- package/output/js/ff/compiler/Syntax.mjs +50 -341
- package/output/js/ff/compiler/Token.mjs +126 -4
- package/output/js/ff/compiler/Tokenizer.mjs +62 -52
- package/output/js/ff/compiler/Unification.mjs +74 -90
- package/output/js/ff/compiler/Wildcards.mjs +4 -2
- package/output/js/ff/compiler/Workspace.mjs +26 -20
- package/output/js/ff/core/Any.mjs +20 -20
- package/output/js/ff/core/Array.mjs +268 -175
- package/output/js/ff/core/AssetSystem.mjs +8 -6
- package/output/js/ff/core/Atomic.mjs +84 -52
- package/output/js/ff/core/Bool.mjs +6 -4
- package/output/js/ff/core/BrowserSystem.mjs +38 -29
- package/output/js/ff/core/Buffer.mjs +285 -133
- package/output/js/ff/core/BuildSystem.mjs +36 -56
- package/output/js/ff/core/Channel.mjs +250 -97
- package/output/js/ff/core/Char.mjs +5 -3
- package/output/js/ff/core/Core.mjs +28 -34
- package/output/js/ff/core/Crypto.mjs +30 -52
- package/output/js/ff/core/Duration.mjs +4 -2
- package/output/js/ff/core/Equal.mjs +14 -12
- package/output/js/ff/core/Error.mjs +17 -11
- package/output/js/ff/core/FileHandle.mjs +76 -38
- package/output/js/ff/core/Float.mjs +92 -160
- package/output/js/ff/core/HttpClient.mjs +208 -76
- package/output/js/ff/core/Instant.mjs +8 -10
- package/output/js/ff/core/Int.mjs +36 -26
- package/output/js/ff/core/IntMap.mjs +79 -33
- package/output/js/ff/core/Js.mjs +751 -0
- package/output/js/ff/core/JsSystem.mjs +54 -60
- package/output/js/ff/core/JsValue.mjs +294 -143
- package/output/js/ff/core/Json.mjs +443 -253
- package/output/js/ff/core/List.mjs +262 -214
- package/output/js/ff/core/Lock.mjs +156 -125
- package/output/js/ff/core/Log.mjs +20 -10
- package/output/js/ff/core/Map.mjs +10 -8
- package/output/js/ff/core/NodeSystem.mjs +189 -123
- package/output/js/ff/core/Nothing.mjs +4 -2
- package/output/js/ff/core/Option.mjs +40 -38
- package/output/js/ff/core/Ordering.mjs +26 -20
- package/output/js/ff/core/Pair.mjs +4 -2
- package/output/js/ff/core/Path.mjs +517 -315
- package/output/js/ff/core/Queue.mjs +306 -0
- package/output/js/ff/core/Random.mjs +141 -77
- package/output/js/ff/core/RbMap.mjs +36 -34
- package/output/js/ff/core/Serializable.mjs +44 -28
- package/output/js/ff/core/Set.mjs +6 -4
- package/output/js/ff/core/Show.mjs +8 -6
- package/output/js/ff/core/SourceLocation.mjs +4 -2
- package/output/js/ff/core/Stream.mjs +30 -50
- package/output/js/ff/core/String.mjs +263 -172
- package/output/js/ff/core/StringMap.mjs +77 -31
- package/output/js/ff/core/Task.mjs +91 -76
- package/output/js/ff/core/Try.mjs +20 -18
- package/output/js/ff/core/Unit.mjs +4 -2
- package/package.json +1 -1
- package/postgresql/Pg.ff +53 -59
- package/rpc/.firefly/package.ff +1 -1
- package/rpc/Rpc.ff +70 -70
- package/s3/.firefly/package.ff +1 -1
- package/s3/S3.ff +92 -94
- package/vscode/LICENSE.txt +21 -21
- package/vscode/Prepublish.ff +15 -15
- package/vscode/README.md +16 -16
- package/vscode/client/package-lock.json +544 -544
- package/vscode/client/package.json +22 -22
- package/vscode/client/src/extension.ts +104 -104
- package/vscode/icons/firefly-icon.svg +10 -10
- package/vscode/language-configuration.json +61 -61
- package/vscode/package-lock.json +3623 -3623
- package/vscode/package.json +1 -1
- package/vscode/snippets.json +241 -241
- package/vscode/syntaxes/firefly-markdown-injection.json +45 -45
- package/webserver/.firefly/include/package.json +5 -5
- package/webserver/.firefly/package.ff +2 -2
- package/webserver/WebServer.ff +647 -685
- package/websocket/.firefly/package.ff +1 -1
- package/websocket/WebSocket.ff +100 -131
- package/core/UnsafeJs.ff +0 -42
- package/output/js/ff/core/UnsafeJs.mjs +0 -191
|
@@ -42,6 +42,8 @@ import * as ff_core_Int from "../../ff/core/Int.mjs"
|
|
|
42
42
|
|
|
43
43
|
import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
|
|
44
44
|
|
|
45
|
+
import * as ff_core_Js from "../../ff/core/Js.mjs"
|
|
46
|
+
|
|
45
47
|
import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
|
|
46
48
|
|
|
47
49
|
import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
|
|
@@ -68,6 +70,8 @@ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
|
|
|
68
70
|
|
|
69
71
|
import * as ff_core_Path from "../../ff/core/Path.mjs"
|
|
70
72
|
|
|
73
|
+
import * as ff_core_Queue from "../../ff/core/Queue.mjs"
|
|
74
|
+
|
|
71
75
|
import * as ff_core_Random from "../../ff/core/Random.mjs"
|
|
72
76
|
|
|
73
77
|
import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
|
|
@@ -90,75 +94,67 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
90
94
|
|
|
91
95
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
92
96
|
|
|
93
|
-
import * as ff_core_UnsafeJs from "../../ff/core/UnsafeJs.mjs"
|
|
94
|
-
|
|
95
97
|
// type List
|
|
96
98
|
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
|
|
100
102
|
export function new_() {
|
|
101
|
-
|
|
102
|
-
return [];
|
|
103
|
-
|
|
103
|
+
return []
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export function fill_(size_, value_) {
|
|
107
|
-
|
|
108
|
-
return new Array(size_).fill(value_);
|
|
109
|
-
|
|
107
|
+
return (new Array(size_)).fill(value_)
|
|
110
108
|
}
|
|
111
109
|
|
|
112
110
|
export function fillBy_(size_, body_) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
if(false) {
|
|
112
|
+
const array_ = (new Array(size_));
|
|
113
|
+
for(let for_i = 1, for_e = size_; for_i < for_e; for_i++) {
|
|
114
|
+
const i_ = for_i;
|
|
115
|
+
array_[i_] = body_(i_)
|
|
116
|
+
};
|
|
117
|
+
return array_
|
|
118
|
+
} else {
|
|
119
|
+
return Array.from({length: size_}, ((_, i_) => {
|
|
120
|
+
return body_(i_)
|
|
121
|
+
}))
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
export function internalSame_(left_, right_) {
|
|
125
|
-
return left_ === right_
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
export function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
export function range_(size_) {
|
|
126
|
+
return Array.from({length: size_}, ((_, i_) => {
|
|
127
|
+
return i_
|
|
128
|
+
}))
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
export async function new_$($task) {
|
|
135
|
-
|
|
132
|
+
return []
|
|
136
133
|
}
|
|
137
134
|
|
|
138
135
|
export async function fill_$(size_, value_, $task) {
|
|
139
|
-
|
|
136
|
+
return (new Array(size_)).fill(value_)
|
|
140
137
|
}
|
|
141
138
|
|
|
142
139
|
export async function fillBy_$(size_, body_, $task) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
140
|
+
if(true) {
|
|
141
|
+
const array_ = (new Array(size_));
|
|
142
|
+
for(let for_i = 1, for_e = size_; for_i < for_e; for_i++) {
|
|
143
|
+
const i_ = for_i;
|
|
144
|
+
array_[i_] = (await body_(i_, $task))
|
|
145
|
+
};
|
|
146
|
+
return array_
|
|
147
|
+
} else {
|
|
148
|
+
return Array.from({length: size_}, (async (a_1, a_2) => await (async (_, i_, $task) => {
|
|
149
|
+
return (await body_(i_, $task))
|
|
150
|
+
})(a_1, a_2, $task)))
|
|
154
151
|
}
|
|
155
|
-
|
|
156
|
-
export async function internalSame_$(left_, right_, $task) {
|
|
157
|
-
throw new Error('Function internalSame is missing on this target in async context.');
|
|
158
152
|
}
|
|
159
153
|
|
|
160
|
-
export async function
|
|
161
|
-
|
|
154
|
+
export async function range_$(size_, $task) {
|
|
155
|
+
return Array.from({length: size_}, ((_, i_) => {
|
|
156
|
+
return i_
|
|
157
|
+
}))
|
|
162
158
|
}
|
|
163
159
|
|
|
164
160
|
export function List_addAll(self_, that_) {
|
|
@@ -166,7 +162,7 @@ return self_.concat(that_)
|
|
|
166
162
|
}
|
|
167
163
|
|
|
168
164
|
export function List_isEmpty(self_) {
|
|
169
|
-
return self_.length === 0
|
|
165
|
+
return (self_.length === 0)
|
|
170
166
|
}
|
|
171
167
|
|
|
172
168
|
export function List_size(self_) {
|
|
@@ -174,17 +170,18 @@ return self_.length
|
|
|
174
170
|
}
|
|
175
171
|
|
|
176
172
|
export function List_get(self_, index_) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
173
|
+
if(((index_ >= 0) && (index_ < self_.length))) {
|
|
174
|
+
return ff_core_Option.Some(self_[index_])
|
|
175
|
+
} else {
|
|
176
|
+
return ff_core_Option.None()
|
|
177
|
+
}
|
|
182
178
|
}
|
|
183
179
|
|
|
184
180
|
export function List_grab(self_, index_) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
if(((index_ < 0) || (index_ >= self_.length))) {
|
|
182
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
|
|
183
|
+
};
|
|
184
|
+
return self_[index_]
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
export function List_first(self_) {
|
|
@@ -196,7 +193,7 @@ return ff_core_List.List_get(self_, (self_.length - 1))
|
|
|
196
193
|
}
|
|
197
194
|
|
|
198
195
|
export function List_grabFirst(self_) {
|
|
199
|
-
return (self_[0] ?? ff_core_List.
|
|
196
|
+
return (self_[0] ?? ff_core_List.List_grab(self_, 0))
|
|
200
197
|
}
|
|
201
198
|
|
|
202
199
|
export function List_grabLast(self_) {
|
|
@@ -208,7 +205,7 @@ return self_.slice(0, count_)
|
|
|
208
205
|
}
|
|
209
206
|
|
|
210
207
|
export function List_takeLast(self_, count_ = 1) {
|
|
211
|
-
return self_.slice(-count_)
|
|
208
|
+
return self_.slice((-count_))
|
|
212
209
|
}
|
|
213
210
|
|
|
214
211
|
export function List_dropFirst(self_, count_ = 1) {
|
|
@@ -216,14 +213,14 @@ return self_.slice(count_)
|
|
|
216
213
|
}
|
|
217
214
|
|
|
218
215
|
export function List_dropLast(self_, count_ = 1) {
|
|
219
|
-
return self_.slice(0, self_.length - count_)
|
|
216
|
+
return self_.slice(0, (self_.length - count_))
|
|
220
217
|
}
|
|
221
218
|
|
|
222
219
|
export function List_count(self_, body_) {
|
|
223
220
|
let result_ = 0;
|
|
224
221
|
let i_ = 0;
|
|
225
222
|
while((i_ < self_.length)) {
|
|
226
|
-
if(body_((self_[i_] ?? ff_core_List.
|
|
223
|
+
if(body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)))) {
|
|
227
224
|
result_ += 1
|
|
228
225
|
};
|
|
229
226
|
i_ += 1
|
|
@@ -233,7 +230,7 @@ return result_
|
|
|
233
230
|
|
|
234
231
|
export function List_countWhile(self_, body_) {
|
|
235
232
|
let i_ = 0;
|
|
236
|
-
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.
|
|
233
|
+
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
|
|
237
234
|
i_ += 1
|
|
238
235
|
};
|
|
239
236
|
return i_
|
|
@@ -242,8 +239,8 @@ return i_
|
|
|
242
239
|
export function List_takeWhile(self_, body_) {
|
|
243
240
|
const result_ = ff_core_Array.new_();
|
|
244
241
|
let i_ = 0;
|
|
245
|
-
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.
|
|
246
|
-
result_.array.push((self_[i_] ?? ff_core_List.
|
|
242
|
+
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
|
|
243
|
+
result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
247
244
|
i_ += 1
|
|
248
245
|
};
|
|
249
246
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -252,11 +249,11 @@ return ff_core_Array.Array_drain(result_)
|
|
|
252
249
|
export function List_dropWhile(self_, body_) {
|
|
253
250
|
const result_ = ff_core_Array.new_();
|
|
254
251
|
let i_ = 0;
|
|
255
|
-
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.
|
|
252
|
+
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
|
|
256
253
|
i_ += 1
|
|
257
254
|
};
|
|
258
255
|
while((i_ < self_.length)) {
|
|
259
|
-
result_.array.push((self_[i_] ?? ff_core_List.
|
|
256
|
+
result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
260
257
|
i_ += 1
|
|
261
258
|
};
|
|
262
259
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -266,12 +263,12 @@ export function List_partitionWhile(self_, body_) {
|
|
|
266
263
|
const first_ = ff_core_Array.new_();
|
|
267
264
|
const second_ = ff_core_Array.new_();
|
|
268
265
|
let i_ = 0;
|
|
269
|
-
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.
|
|
270
|
-
first_.array.push((self_[i_] ?? ff_core_List.
|
|
266
|
+
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
|
|
267
|
+
first_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
271
268
|
i_ += 1
|
|
272
269
|
};
|
|
273
270
|
while((i_ < self_.length)) {
|
|
274
|
-
second_.array.push((self_[i_] ?? ff_core_List.
|
|
271
|
+
second_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
275
272
|
i_ += 1
|
|
276
273
|
};
|
|
277
274
|
return ff_core_Pair.Pair(ff_core_Array.Array_drain(first_), ff_core_Array.Array_drain(second_))
|
|
@@ -292,7 +289,7 @@ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (u
|
|
|
292
289
|
|
|
293
290
|
export function List_foldLeft(self_, initial_, body_) {
|
|
294
291
|
let result_ = initial_;
|
|
295
|
-
for(let
|
|
292
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
296
293
|
const x_ = for_a[for_i];
|
|
297
294
|
result_ = body_(result_, x_)
|
|
298
295
|
};
|
|
@@ -306,14 +303,12 @@ return value_
|
|
|
306
303
|
}
|
|
307
304
|
|
|
308
305
|
export function List_modify(self_, index_, body_) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
return result;
|
|
316
|
-
|
|
306
|
+
if(((index_ < 0) || (index_ >= self_.length))) {
|
|
307
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
|
|
308
|
+
};
|
|
309
|
+
const result_ = self_.slice();
|
|
310
|
+
result_[index_] = body_(result_[index_]);
|
|
311
|
+
return result_
|
|
317
312
|
}
|
|
318
313
|
|
|
319
314
|
export function List_zip(self_, that_) {
|
|
@@ -321,13 +316,13 @@ if((self_.length <= that_.length)) {
|
|
|
321
316
|
let i_ = (-1);
|
|
322
317
|
return ff_core_List.List_map(self_, ((x_) => {
|
|
323
318
|
i_ += 1;
|
|
324
|
-
return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.
|
|
319
|
+
return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.List_grab(that_, i_)))
|
|
325
320
|
}))
|
|
326
321
|
} else {
|
|
327
322
|
let i_ = (-1);
|
|
328
323
|
return ff_core_List.List_map(that_, ((y_) => {
|
|
329
324
|
i_ += 1;
|
|
330
|
-
return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.
|
|
325
|
+
return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.List_grab(self_, i_)), y_)
|
|
331
326
|
}))
|
|
332
327
|
}
|
|
333
328
|
}
|
|
@@ -336,7 +331,7 @@ export function List_chunk(self_, chunkSize_) {
|
|
|
336
331
|
const results_ = ff_core_Array.new_();
|
|
337
332
|
const result_ = ff_core_Array.new_();
|
|
338
333
|
let added_ = 0;
|
|
339
|
-
for(let
|
|
334
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
340
335
|
const item_ = for_a[for_i];
|
|
341
336
|
if((added_ < chunkSize_)) {
|
|
342
337
|
added_ += 1
|
|
@@ -357,13 +352,13 @@ let index_ = 0;
|
|
|
357
352
|
return ff_core_Stream.new_((() => {
|
|
358
353
|
if((index_ < self_.length)) {
|
|
359
354
|
return ff_core_Option.Some((function() {
|
|
360
|
-
const result_ = (self_[index_] ?? ff_core_List.
|
|
355
|
+
const result_ = (self_[index_] ?? ff_core_List.List_grab(self_, index_));
|
|
361
356
|
index_ += 1;
|
|
362
357
|
return result_
|
|
363
358
|
})())
|
|
364
359
|
} else if((cycle_ && (index_ !== 0))) {
|
|
365
360
|
return ff_core_Option.Some((function() {
|
|
366
|
-
const result_ = (self_[0] ?? ff_core_List.
|
|
361
|
+
const result_ = (self_[0] ?? ff_core_List.List_grab(self_, 0));
|
|
367
362
|
index_ = 1;
|
|
368
363
|
return result_
|
|
369
364
|
})())
|
|
@@ -377,21 +372,39 @@ export function List_toArray(self_) {
|
|
|
377
372
|
return {array: self_.slice()}
|
|
378
373
|
}
|
|
379
374
|
|
|
375
|
+
export function List_toQueue(self_) {
|
|
376
|
+
const queue_ = ff_core_Queue.new_();
|
|
377
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
378
|
+
const v_ = for_a[for_i];
|
|
379
|
+
ff_core_Queue.Queue_push(queue_, v_)
|
|
380
|
+
};
|
|
381
|
+
return queue_
|
|
382
|
+
}
|
|
383
|
+
|
|
380
384
|
export function List_each(self_, body_) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
385
|
+
let i_ = 0;
|
|
386
|
+
while((i_ < self_.length)) {
|
|
387
|
+
body_(self_[i_]);
|
|
388
|
+
i_ += 1
|
|
389
|
+
}
|
|
384
390
|
}
|
|
385
391
|
|
|
386
392
|
export function List_eachWhile(self_, body_) {
|
|
387
|
-
|
|
393
|
+
let i_ = 0;
|
|
394
|
+
while((i_ < self_.length)) {
|
|
395
|
+
if(body_(self_[i_])) {
|
|
396
|
+
i_ += 1
|
|
397
|
+
} else {
|
|
398
|
+
i_ = self_.length
|
|
399
|
+
}
|
|
400
|
+
}
|
|
388
401
|
}
|
|
389
402
|
|
|
390
403
|
export function List_all(self_, body_) {
|
|
391
404
|
let result_ = true;
|
|
392
|
-
for(let
|
|
405
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
393
406
|
const x_ = for_a[for_i];
|
|
394
|
-
result_ =
|
|
407
|
+
result_ = body_(x_);
|
|
395
408
|
if(!result_) break
|
|
396
409
|
};
|
|
397
410
|
return result_
|
|
@@ -399,40 +412,45 @@ return result_
|
|
|
399
412
|
|
|
400
413
|
export function List_any(self_, body_) {
|
|
401
414
|
let result_ = false;
|
|
402
|
-
for(let
|
|
415
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
403
416
|
const x_ = for_a[for_i];
|
|
404
|
-
result_ =
|
|
417
|
+
result_ = body_(x_);
|
|
405
418
|
if(!(!result_)) break
|
|
406
419
|
};
|
|
407
420
|
return result_
|
|
408
421
|
}
|
|
409
422
|
|
|
410
|
-
export function
|
|
423
|
+
export function List_find(self_, body_) {
|
|
411
424
|
let result_ = ff_core_Option.None();
|
|
412
|
-
let
|
|
413
|
-
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
425
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
414
426
|
const x_ = for_a[for_i];
|
|
415
|
-
if(
|
|
416
|
-
|
|
417
|
-
|
|
427
|
+
if(body_(x_)) {
|
|
428
|
+
result_ = ff_core_Option.Some(x_);
|
|
429
|
+
if(!false) break
|
|
430
|
+
} else {
|
|
431
|
+
if(!true) break
|
|
432
|
+
}
|
|
418
433
|
};
|
|
419
434
|
return result_
|
|
420
435
|
}
|
|
421
436
|
|
|
422
|
-
export function
|
|
423
|
-
let
|
|
424
|
-
|
|
437
|
+
export function List_indexWhere(self_, body_) {
|
|
438
|
+
let i_ = (-1);
|
|
439
|
+
let result_ = false;
|
|
440
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
425
441
|
const x_ = for_a[for_i];
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
442
|
+
i_ += 1;
|
|
443
|
+
result_ = body_(x_);
|
|
444
|
+
if(!(!result_)) break
|
|
429
445
|
};
|
|
430
|
-
|
|
446
|
+
if(result_) {
|
|
447
|
+
return ff_core_Option.Some(i_)
|
|
448
|
+
} else return ff_core_Option.None()
|
|
431
449
|
}
|
|
432
450
|
|
|
433
451
|
export function List_filter(self_, body_) {
|
|
434
452
|
const result_ = ff_core_Array.new_();
|
|
435
|
-
for(let
|
|
453
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
436
454
|
const x_ = for_a[for_i];
|
|
437
455
|
if(body_(x_)) {
|
|
438
456
|
result_.array.push(x_)
|
|
@@ -448,14 +466,17 @@ return (!body_(_w1))
|
|
|
448
466
|
}
|
|
449
467
|
|
|
450
468
|
export function List_map(self_, body_) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
469
|
+
const array_ = ff_core_Array.new_();
|
|
470
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
471
|
+
const e_ = for_a[for_i];
|
|
472
|
+
array_.array.push(body_(e_))
|
|
473
|
+
};
|
|
474
|
+
return ff_core_Array.Array_drain(array_)
|
|
454
475
|
}
|
|
455
476
|
|
|
456
477
|
export function List_flatMap(self_, body_) {
|
|
457
478
|
const results_ = ff_core_Array.new_();
|
|
458
|
-
for(let
|
|
479
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
459
480
|
const x_ = for_a[for_i];
|
|
460
481
|
ff_core_Array.Array_pushList(results_, body_(x_))
|
|
461
482
|
};
|
|
@@ -464,12 +485,14 @@ return ff_core_Array.Array_drain(results_)
|
|
|
464
485
|
|
|
465
486
|
export function List_collect(self_, body_) {
|
|
466
487
|
let result_ = ff_core_Array.new_();
|
|
467
|
-
for(let
|
|
488
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
468
489
|
const x_ = for_a[for_i];
|
|
469
|
-
|
|
470
|
-
const
|
|
490
|
+
{
|
|
491
|
+
const if_o = body_(x_)
|
|
492
|
+
if(if_o.Some) {
|
|
493
|
+
const _w1 = if_o.value_;
|
|
471
494
|
result_.array.push(_w1)
|
|
472
|
-
|
|
495
|
+
}
|
|
473
496
|
}
|
|
474
497
|
};
|
|
475
498
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -477,18 +500,20 @@ return ff_core_Array.Array_drain(result_)
|
|
|
477
500
|
|
|
478
501
|
export function List_collectFirst(self_, body_) {
|
|
479
502
|
let result_ = ff_core_Option.None();
|
|
480
|
-
for(let
|
|
503
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
481
504
|
const x_ = for_a[for_i];
|
|
482
|
-
|
|
505
|
+
{
|
|
506
|
+
const _1 = body_(x_);
|
|
483
507
|
if(_1.None) {
|
|
484
|
-
|
|
508
|
+
if(!true) break
|
|
509
|
+
continue
|
|
485
510
|
}
|
|
486
511
|
{
|
|
487
512
|
const o_ = _1;
|
|
488
513
|
result_ = o_;
|
|
489
|
-
|
|
514
|
+
if(!false) break
|
|
515
|
+
}
|
|
490
516
|
}
|
|
491
|
-
}))(body_(x_))) break
|
|
492
517
|
};
|
|
493
518
|
return result_
|
|
494
519
|
}
|
|
@@ -513,38 +538,42 @@ return ff_core_List.List_grab(self_, (self_.length - i_))
|
|
|
513
538
|
|
|
514
539
|
export function List_separate(self_, separator_) {
|
|
515
540
|
const array_ = ff_core_Array.new_();
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const
|
|
519
|
-
const x_ = _1.second_;
|
|
541
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
542
|
+
const i_ = for_i;
|
|
543
|
+
const x_ = for_a[for_i];
|
|
520
544
|
if((i_ !== 0)) {
|
|
521
545
|
ff_core_Array.Array_pushList(array_, separator_)
|
|
522
546
|
};
|
|
523
547
|
array_.array.push(x_)
|
|
524
|
-
|
|
525
|
-
}
|
|
526
|
-
}));
|
|
548
|
+
};
|
|
527
549
|
return ff_core_Array.Array_drain(array_)
|
|
528
550
|
}
|
|
529
551
|
|
|
530
552
|
export async function List_addAll$(self_, that_, $task) {
|
|
531
|
-
|
|
553
|
+
return self_.concat(that_)
|
|
532
554
|
}
|
|
533
555
|
|
|
534
556
|
export async function List_isEmpty$(self_, $task) {
|
|
535
|
-
|
|
557
|
+
return (self_.length === 0)
|
|
536
558
|
}
|
|
537
559
|
|
|
538
560
|
export async function List_size$(self_, $task) {
|
|
539
|
-
|
|
561
|
+
return self_.length
|
|
540
562
|
}
|
|
541
563
|
|
|
542
564
|
export async function List_get$(self_, index_, $task) {
|
|
543
|
-
|
|
565
|
+
if(((index_ >= 0) && (index_ < self_.length))) {
|
|
566
|
+
return ff_core_Option.Some(self_[index_])
|
|
567
|
+
} else {
|
|
568
|
+
return ff_core_Option.None()
|
|
569
|
+
}
|
|
544
570
|
}
|
|
545
571
|
|
|
546
572
|
export async function List_grab$(self_, index_, $task) {
|
|
547
|
-
|
|
573
|
+
if(((index_ < 0) || (index_ >= self_.length))) {
|
|
574
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
|
|
575
|
+
};
|
|
576
|
+
return self_[index_]
|
|
548
577
|
}
|
|
549
578
|
|
|
550
579
|
export async function List_first$(self_, $task) {
|
|
@@ -556,7 +585,7 @@ return ff_core_List.List_get(self_, (self_.length - 1))
|
|
|
556
585
|
}
|
|
557
586
|
|
|
558
587
|
export async function List_grabFirst$(self_, $task) {
|
|
559
|
-
return (self_[0] ?? ff_core_List.
|
|
588
|
+
return (self_[0] ?? ff_core_List.List_grab(self_, 0))
|
|
560
589
|
}
|
|
561
590
|
|
|
562
591
|
export async function List_grabLast$(self_, $task) {
|
|
@@ -564,26 +593,26 @@ return ff_core_List.List_grab(self_, (self_.length - 1))
|
|
|
564
593
|
}
|
|
565
594
|
|
|
566
595
|
export async function List_takeFirst$(self_, count_ = 1, $task) {
|
|
567
|
-
|
|
596
|
+
return self_.slice(0, count_)
|
|
568
597
|
}
|
|
569
598
|
|
|
570
599
|
export async function List_takeLast$(self_, count_ = 1, $task) {
|
|
571
|
-
|
|
600
|
+
return self_.slice((-count_))
|
|
572
601
|
}
|
|
573
602
|
|
|
574
603
|
export async function List_dropFirst$(self_, count_ = 1, $task) {
|
|
575
|
-
|
|
604
|
+
return self_.slice(count_)
|
|
576
605
|
}
|
|
577
606
|
|
|
578
607
|
export async function List_dropLast$(self_, count_ = 1, $task) {
|
|
579
|
-
|
|
608
|
+
return self_.slice(0, (self_.length - count_))
|
|
580
609
|
}
|
|
581
610
|
|
|
582
611
|
export async function List_count$(self_, body_, $task) {
|
|
583
612
|
let result_ = 0;
|
|
584
613
|
let i_ = 0;
|
|
585
614
|
while((i_ < self_.length)) {
|
|
586
|
-
if((await body_((self_[i_] ?? ff_core_List.
|
|
615
|
+
if((await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task))) {
|
|
587
616
|
result_ += 1
|
|
588
617
|
};
|
|
589
618
|
i_ += 1
|
|
@@ -593,7 +622,7 @@ return result_
|
|
|
593
622
|
|
|
594
623
|
export async function List_countWhile$(self_, body_, $task) {
|
|
595
624
|
let i_ = 0;
|
|
596
|
-
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.
|
|
625
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
|
|
597
626
|
i_ += 1
|
|
598
627
|
};
|
|
599
628
|
return i_
|
|
@@ -602,8 +631,8 @@ return i_
|
|
|
602
631
|
export async function List_takeWhile$(self_, body_, $task) {
|
|
603
632
|
const result_ = ff_core_Array.new_();
|
|
604
633
|
let i_ = 0;
|
|
605
|
-
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.
|
|
606
|
-
result_.array.push((self_[i_] ?? ff_core_List.
|
|
634
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
|
|
635
|
+
result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
607
636
|
i_ += 1
|
|
608
637
|
};
|
|
609
638
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -612,11 +641,11 @@ return ff_core_Array.Array_drain(result_)
|
|
|
612
641
|
export async function List_dropWhile$(self_, body_, $task) {
|
|
613
642
|
const result_ = ff_core_Array.new_();
|
|
614
643
|
let i_ = 0;
|
|
615
|
-
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.
|
|
644
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
|
|
616
645
|
i_ += 1
|
|
617
646
|
};
|
|
618
647
|
while((i_ < self_.length)) {
|
|
619
|
-
result_.array.push((self_[i_] ?? ff_core_List.
|
|
648
|
+
result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
620
649
|
i_ += 1
|
|
621
650
|
};
|
|
622
651
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -626,12 +655,12 @@ export async function List_partitionWhile$(self_, body_, $task) {
|
|
|
626
655
|
const first_ = ff_core_Array.new_();
|
|
627
656
|
const second_ = ff_core_Array.new_();
|
|
628
657
|
let i_ = 0;
|
|
629
|
-
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.
|
|
630
|
-
first_.array.push((self_[i_] ?? ff_core_List.
|
|
658
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
|
|
659
|
+
first_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
631
660
|
i_ += 1
|
|
632
661
|
};
|
|
633
662
|
while((i_ < self_.length)) {
|
|
634
|
-
second_.array.push((self_[i_] ?? ff_core_List.
|
|
663
|
+
second_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
|
|
635
664
|
i_ += 1
|
|
636
665
|
};
|
|
637
666
|
return ff_core_Pair.Pair(ff_core_Array.Array_drain(first_), ff_core_Array.Array_drain(second_))
|
|
@@ -652,7 +681,7 @@ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (u
|
|
|
652
681
|
|
|
653
682
|
export async function List_foldLeft$(self_, initial_, body_, $task) {
|
|
654
683
|
let result_ = initial_;
|
|
655
|
-
for(let
|
|
684
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
656
685
|
const x_ = for_a[for_i];
|
|
657
686
|
result_ = (await body_(result_, x_, $task))
|
|
658
687
|
};
|
|
@@ -666,14 +695,12 @@ return value_
|
|
|
666
695
|
}
|
|
667
696
|
|
|
668
697
|
export async function List_modify$(self_, index_, body_, $task) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
return result;
|
|
676
|
-
|
|
698
|
+
if(((index_ < 0) || (index_ >= self_.length))) {
|
|
699
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
|
|
700
|
+
};
|
|
701
|
+
const result_ = self_.slice();
|
|
702
|
+
result_[index_] = (await body_(result_[index_], $task));
|
|
703
|
+
return result_
|
|
677
704
|
}
|
|
678
705
|
|
|
679
706
|
export async function List_zip$(self_, that_, $task) {
|
|
@@ -681,13 +708,13 @@ if((self_.length <= that_.length)) {
|
|
|
681
708
|
let i_ = (-1);
|
|
682
709
|
return ff_core_List.List_map(self_, ((x_) => {
|
|
683
710
|
i_ += 1;
|
|
684
|
-
return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.
|
|
711
|
+
return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.List_grab(that_, i_)))
|
|
685
712
|
}))
|
|
686
713
|
} else {
|
|
687
714
|
let i_ = (-1);
|
|
688
715
|
return ff_core_List.List_map(that_, ((y_) => {
|
|
689
716
|
i_ += 1;
|
|
690
|
-
return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.
|
|
717
|
+
return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.List_grab(self_, i_)), y_)
|
|
691
718
|
}))
|
|
692
719
|
}
|
|
693
720
|
}
|
|
@@ -696,7 +723,7 @@ export async function List_chunk$(self_, chunkSize_, $task) {
|
|
|
696
723
|
const results_ = ff_core_Array.new_();
|
|
697
724
|
const result_ = ff_core_Array.new_();
|
|
698
725
|
let added_ = 0;
|
|
699
|
-
for(let
|
|
726
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
700
727
|
const item_ = for_a[for_i];
|
|
701
728
|
if((added_ < chunkSize_)) {
|
|
702
729
|
added_ += 1
|
|
@@ -717,13 +744,13 @@ let index_ = 0;
|
|
|
717
744
|
return (await ff_core_Stream.new_$((async ($task) => {
|
|
718
745
|
if((index_ < self_.length)) {
|
|
719
746
|
return ff_core_Option.Some((await (async function() {
|
|
720
|
-
const result_ = (self_[index_] ?? ff_core_List.
|
|
747
|
+
const result_ = (self_[index_] ?? ff_core_List.List_grab(self_, index_));
|
|
721
748
|
index_ += 1;
|
|
722
749
|
return result_
|
|
723
750
|
})()))
|
|
724
751
|
} else if((cycle_ && (index_ !== 0))) {
|
|
725
752
|
return ff_core_Option.Some((await (async function() {
|
|
726
|
-
const result_ = (self_[0] ?? ff_core_List.
|
|
753
|
+
const result_ = (self_[0] ?? ff_core_List.List_grab(self_, 0));
|
|
727
754
|
index_ = 1;
|
|
728
755
|
return result_
|
|
729
756
|
})()))
|
|
@@ -734,26 +761,42 @@ return result_
|
|
|
734
761
|
}
|
|
735
762
|
|
|
736
763
|
export async function List_toArray$(self_, $task) {
|
|
737
|
-
|
|
764
|
+
return {array: self_.slice()}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export async function List_toQueue$(self_, $task) {
|
|
768
|
+
const queue_ = ff_core_Queue.new_();
|
|
769
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
770
|
+
const v_ = for_a[for_i];
|
|
771
|
+
ff_core_Queue.Queue_push(queue_, v_)
|
|
772
|
+
};
|
|
773
|
+
return queue_
|
|
738
774
|
}
|
|
739
775
|
|
|
740
776
|
export async function List_each$(self_, body_, $task) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
777
|
+
let i_ = 0;
|
|
778
|
+
while((i_ < self_.length)) {
|
|
779
|
+
(await body_(self_[i_], $task));
|
|
780
|
+
i_ += 1
|
|
781
|
+
}
|
|
746
782
|
}
|
|
747
783
|
|
|
748
784
|
export async function List_eachWhile$(self_, body_, $task) {
|
|
749
|
-
|
|
785
|
+
let i_ = 0;
|
|
786
|
+
while((i_ < self_.length)) {
|
|
787
|
+
if((await body_(self_[i_], $task))) {
|
|
788
|
+
i_ += 1
|
|
789
|
+
} else {
|
|
790
|
+
i_ = self_.length
|
|
791
|
+
}
|
|
792
|
+
}
|
|
750
793
|
}
|
|
751
794
|
|
|
752
795
|
export async function List_all$(self_, body_, $task) {
|
|
753
796
|
let result_ = true;
|
|
754
|
-
for(let
|
|
797
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
755
798
|
const x_ = for_a[for_i];
|
|
756
|
-
result_ = (
|
|
799
|
+
result_ = (await body_(x_, $task));
|
|
757
800
|
if(!result_) break
|
|
758
801
|
};
|
|
759
802
|
return result_
|
|
@@ -761,40 +804,45 @@ return result_
|
|
|
761
804
|
|
|
762
805
|
export async function List_any$(self_, body_, $task) {
|
|
763
806
|
let result_ = false;
|
|
764
|
-
for(let
|
|
807
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
765
808
|
const x_ = for_a[for_i];
|
|
766
|
-
result_ = (
|
|
809
|
+
result_ = (await body_(x_, $task));
|
|
767
810
|
if(!(!result_)) break
|
|
768
811
|
};
|
|
769
812
|
return result_
|
|
770
813
|
}
|
|
771
814
|
|
|
772
|
-
export async function
|
|
815
|
+
export async function List_find$(self_, body_, $task) {
|
|
773
816
|
let result_ = ff_core_Option.None();
|
|
774
|
-
let
|
|
775
|
-
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
817
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
776
818
|
const x_ = for_a[for_i];
|
|
777
|
-
if(
|
|
778
|
-
|
|
779
|
-
|
|
819
|
+
if((await body_(x_, $task))) {
|
|
820
|
+
result_ = ff_core_Option.Some(x_);
|
|
821
|
+
if(!false) break
|
|
822
|
+
} else {
|
|
823
|
+
if(!true) break
|
|
824
|
+
}
|
|
780
825
|
};
|
|
781
826
|
return result_
|
|
782
827
|
}
|
|
783
828
|
|
|
784
|
-
export async function
|
|
785
|
-
let
|
|
786
|
-
|
|
829
|
+
export async function List_indexWhere$(self_, body_, $task) {
|
|
830
|
+
let i_ = (-1);
|
|
831
|
+
let result_ = false;
|
|
832
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
787
833
|
const x_ = for_a[for_i];
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
834
|
+
i_ += 1;
|
|
835
|
+
result_ = (await body_(x_, $task));
|
|
836
|
+
if(!(!result_)) break
|
|
791
837
|
};
|
|
792
|
-
|
|
838
|
+
if(result_) {
|
|
839
|
+
return ff_core_Option.Some(i_)
|
|
840
|
+
} else return ff_core_Option.None()
|
|
793
841
|
}
|
|
794
842
|
|
|
795
843
|
export async function List_filter$(self_, body_, $task) {
|
|
796
844
|
const result_ = ff_core_Array.new_();
|
|
797
|
-
for(let
|
|
845
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
798
846
|
const x_ = for_a[for_i];
|
|
799
847
|
if((await body_(x_, $task))) {
|
|
800
848
|
result_.array.push(x_)
|
|
@@ -810,18 +858,17 @@ return (!(await body_(_w1, $task)))
|
|
|
810
858
|
}
|
|
811
859
|
|
|
812
860
|
export async function List_map$(self_, body_, $task) {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
861
|
+
const array_ = ff_core_Array.new_();
|
|
862
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
863
|
+
const e_ = for_a[for_i];
|
|
864
|
+
array_.array.push((await body_(e_, $task)))
|
|
865
|
+
};
|
|
866
|
+
return ff_core_Array.Array_drain(array_)
|
|
820
867
|
}
|
|
821
868
|
|
|
822
869
|
export async function List_flatMap$(self_, body_, $task) {
|
|
823
870
|
const results_ = ff_core_Array.new_();
|
|
824
|
-
for(let
|
|
871
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
825
872
|
const x_ = for_a[for_i];
|
|
826
873
|
ff_core_Array.Array_pushList(results_, (await body_(x_, $task)))
|
|
827
874
|
};
|
|
@@ -830,12 +877,14 @@ return ff_core_Array.Array_drain(results_)
|
|
|
830
877
|
|
|
831
878
|
export async function List_collect$(self_, body_, $task) {
|
|
832
879
|
let result_ = ff_core_Array.new_();
|
|
833
|
-
for(let
|
|
880
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
834
881
|
const x_ = for_a[for_i];
|
|
835
|
-
|
|
836
|
-
const
|
|
882
|
+
{
|
|
883
|
+
const if_o = (await body_(x_, $task))
|
|
884
|
+
if(if_o.Some) {
|
|
885
|
+
const _w1 = if_o.value_;
|
|
837
886
|
result_.array.push(_w1)
|
|
838
|
-
|
|
887
|
+
}
|
|
839
888
|
}
|
|
840
889
|
};
|
|
841
890
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -843,18 +892,20 @@ return ff_core_Array.Array_drain(result_)
|
|
|
843
892
|
|
|
844
893
|
export async function List_collectFirst$(self_, body_, $task) {
|
|
845
894
|
let result_ = ff_core_Option.None();
|
|
846
|
-
for(let
|
|
895
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
847
896
|
const x_ = for_a[for_i];
|
|
848
|
-
|
|
897
|
+
{
|
|
898
|
+
const _1 = (await body_(x_, $task));
|
|
849
899
|
if(_1.None) {
|
|
850
|
-
|
|
900
|
+
if(!true) break
|
|
901
|
+
continue
|
|
851
902
|
}
|
|
852
903
|
{
|
|
853
904
|
const o_ = _1;
|
|
854
905
|
result_ = o_;
|
|
855
|
-
|
|
906
|
+
if(!false) break
|
|
907
|
+
}
|
|
856
908
|
}
|
|
857
|
-
}))((await body_(x_, $task)))) break
|
|
858
909
|
};
|
|
859
910
|
return result_
|
|
860
911
|
}
|
|
@@ -879,17 +930,14 @@ return ff_core_List.List_grab(self_, (self_.length - i_))
|
|
|
879
930
|
|
|
880
931
|
export async function List_separate$(self_, separator_, $task) {
|
|
881
932
|
const array_ = ff_core_Array.new_();
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
-
const x_ = _1.second_;
|
|
933
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
934
|
+
const i_ = for_i;
|
|
935
|
+
const x_ = for_a[for_i];
|
|
886
936
|
if((i_ !== 0)) {
|
|
887
937
|
ff_core_Array.Array_pushList(array_, separator_)
|
|
888
938
|
};
|
|
889
939
|
array_.array.push(x_)
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
}));
|
|
940
|
+
};
|
|
893
941
|
return ff_core_Array.Array_drain(array_)
|
|
894
942
|
}
|
|
895
943
|
|
|
@@ -951,7 +999,7 @@ return false
|
|
|
951
999
|
|
|
952
1000
|
export function List_flatten(self_) {
|
|
953
1001
|
const result_ = ff_core_Array.new_();
|
|
954
|
-
for(let
|
|
1002
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
955
1003
|
const xs_ = for_a[for_i];
|
|
956
1004
|
ff_core_Array.Array_pushList(result_, xs_)
|
|
957
1005
|
};
|
|
@@ -960,7 +1008,7 @@ return ff_core_Array.Array_drain(result_)
|
|
|
960
1008
|
|
|
961
1009
|
export async function List_flatten$(self_, $task) {
|
|
962
1010
|
const result_ = ff_core_Array.new_();
|
|
963
|
-
for(let
|
|
1011
|
+
for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
964
1012
|
const xs_ = for_a[for_i];
|
|
965
1013
|
ff_core_Array.Array_pushList(result_, xs_)
|
|
966
1014
|
};
|
|
@@ -1054,14 +1102,14 @@ return self_.join(separator_)
|
|
|
1054
1102
|
}
|
|
1055
1103
|
|
|
1056
1104
|
export async function List_join$(self_, separator_ = "", $task) {
|
|
1057
|
-
|
|
1105
|
+
return self_.join(separator_)
|
|
1058
1106
|
}
|
|
1059
1107
|
|
|
1060
1108
|
export function ff_core_Show_Show$ff_core_List_List(ff_core_Show_Show$T) { return {
|
|
1061
1109
|
show_(value_) {
|
|
1062
1110
|
const array_ = ff_core_Array.new_();
|
|
1063
1111
|
array_.array.push("[");
|
|
1064
|
-
for(let
|
|
1112
|
+
for(let for_a = value_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1065
1113
|
const x_ = for_a[for_i];
|
|
1066
1114
|
if((array_.array.length > 1)) {
|
|
1067
1115
|
array_.array.push(", ")
|
|
@@ -1074,7 +1122,7 @@ return ff_core_Array.Array_join(array_, "")
|
|
|
1074
1122
|
async show_$(value_, $task) {
|
|
1075
1123
|
const array_ = ff_core_Array.new_();
|
|
1076
1124
|
array_.array.push("[");
|
|
1077
|
-
for(let
|
|
1125
|
+
for(let for_a = value_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1078
1126
|
const x_ = for_a[for_i];
|
|
1079
1127
|
if((array_.array.length > 1)) {
|
|
1080
1128
|
array_.array.push(", ")
|
|
@@ -1088,7 +1136,7 @@ return ff_core_Array.Array_join(array_, "")
|
|
|
1088
1136
|
|
|
1089
1137
|
export function ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T) { return {
|
|
1090
1138
|
equals_(x_, y_) {
|
|
1091
|
-
if(
|
|
1139
|
+
if((x_ === y_)) {
|
|
1092
1140
|
return true
|
|
1093
1141
|
} else {
|
|
1094
1142
|
if((x_.length !== y_.length)) {
|
|
@@ -1097,13 +1145,13 @@ return false
|
|
|
1097
1145
|
let i_ = (-1);
|
|
1098
1146
|
return ff_core_List.List_all(x_, ((l_) => {
|
|
1099
1147
|
i_ += 1;
|
|
1100
|
-
return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.
|
|
1148
|
+
return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.List_grab(y_, i_)))
|
|
1101
1149
|
}))
|
|
1102
1150
|
}
|
|
1103
1151
|
}
|
|
1104
1152
|
},
|
|
1105
1153
|
async equals_$(x_, y_, $task) {
|
|
1106
|
-
if(
|
|
1154
|
+
if((x_ === y_)) {
|
|
1107
1155
|
return true
|
|
1108
1156
|
} else {
|
|
1109
1157
|
if((x_.length !== y_.length)) {
|
|
@@ -1112,7 +1160,7 @@ return false
|
|
|
1112
1160
|
let i_ = (-1);
|
|
1113
1161
|
return ff_core_List.List_all(x_, ((l_) => {
|
|
1114
1162
|
i_ += 1;
|
|
1115
|
-
return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.
|
|
1163
|
+
return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.List_grab(y_, i_)))
|
|
1116
1164
|
}))
|
|
1117
1165
|
}
|
|
1118
1166
|
}
|
|
@@ -1121,14 +1169,14 @@ return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.internalGrab_(y
|
|
|
1121
1169
|
|
|
1122
1170
|
export function ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering_Order$T) { return {
|
|
1123
1171
|
compare_(x_, y_) {
|
|
1124
|
-
if(
|
|
1172
|
+
if((x_ === y_)) {
|
|
1125
1173
|
return ff_core_Ordering.OrderingSame()
|
|
1126
1174
|
} else {
|
|
1127
1175
|
const size_ = ff_core_Int.Int_min(x_.length, y_.length);
|
|
1128
1176
|
let i_ = 0;
|
|
1129
1177
|
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
1130
1178
|
while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
|
|
1131
|
-
ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.
|
|
1179
|
+
ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.List_grab(x_, i_)), (y_[i_] ?? ff_core_List.List_grab(y_, i_)));
|
|
1132
1180
|
i_ += 1
|
|
1133
1181
|
};
|
|
1134
1182
|
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|
|
@@ -1139,14 +1187,14 @@ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.lengt
|
|
|
1139
1187
|
}
|
|
1140
1188
|
},
|
|
1141
1189
|
async compare_$(x_, y_, $task) {
|
|
1142
|
-
if(
|
|
1190
|
+
if((x_ === y_)) {
|
|
1143
1191
|
return ff_core_Ordering.OrderingSame()
|
|
1144
1192
|
} else {
|
|
1145
1193
|
const size_ = ff_core_Int.Int_min(x_.length, y_.length);
|
|
1146
1194
|
let i_ = 0;
|
|
1147
1195
|
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
1148
1196
|
while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
|
|
1149
|
-
ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.
|
|
1197
|
+
ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.List_grab(x_, i_)), (y_[i_] ?? ff_core_List.List_grab(y_, i_)));
|
|
1150
1198
|
i_ += 1
|
|
1151
1199
|
};
|
|
1152
1200
|
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|