@grain/stdlib 0.7.0 → 0.7.2
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/CHANGELOG.md +18 -0
- package/array.md +491 -491
- package/bigint.md +198 -198
- package/buffer.gr +66 -1
- package/buffer.md +395 -272
- package/bytes.gr +1 -0
- package/bytes.md +200 -199
- package/char.md +125 -125
- package/exception.md +9 -9
- package/float32.md +195 -195
- package/float64.md +195 -195
- package/fs.md +115 -115
- package/hash.md +16 -16
- package/int16.md +155 -155
- package/int32.gr +1 -1
- package/int32.md +207 -207
- package/int64.gr +1 -1
- package/int64.md +207 -207
- package/int8.md +155 -155
- package/json.md +59 -59
- package/list.md +347 -347
- package/map.md +222 -222
- package/marshal.md +12 -12
- package/number.gr +119 -5
- package/number.md +503 -261
- package/option.md +141 -141
- package/package.json +2 -2
- package/path.gr +82 -65
- package/path.md +210 -141
- package/pervasives.md +238 -238
- package/priorityqueue.md +112 -112
- package/queue.md +117 -117
- package/random.md +37 -37
- package/range.md +36 -36
- package/rational.md +107 -107
- package/regex.md +91 -91
- package/result.md +102 -102
- package/runtime/atof/decimal.md +6 -6
- package/runtime/compare.md +7 -7
- package/runtime/dataStructures.md +178 -178
- package/runtime/equal.md +7 -7
- package/runtime/exception.md +15 -15
- package/runtime/malloc.md +9 -9
- package/runtime/numbers.md +269 -269
- package/runtime/string.md +17 -17
- package/runtime/unsafe/conv.md +6 -6
- package/runtime/unsafe/memory.gr +2 -19
- package/runtime/unsafe/memory.md +10 -10
- package/runtime/utf8.md +31 -31
- package/runtime/wasi.md +9 -9
- package/set.md +211 -211
- package/stack.md +122 -122
- package/string.md +228 -228
- package/uint16.md +148 -148
- package/uint32.md +192 -192
- package/uint64.md +192 -192
- package/uint8.md +148 -148
- package/uri.md +77 -77
- package/wasi/file.md +269 -269
- package/wasi/process.md +21 -21
- package/wasi/random.md +9 -9
- package/wasi/time.md +12 -12
package/set.md
CHANGED
|
@@ -65,15 +65,15 @@ can use the default size.
|
|
|
65
65
|
|
|
66
66
|
Parameters:
|
|
67
67
|
|
|
68
|
-
|param|type|description|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
| param | type | description |
|
|
69
|
+
| ------- | -------- | ----------------------------------- |
|
|
70
|
+
| `?size` | `Number` | The initial storage size of the set |
|
|
71
71
|
|
|
72
72
|
Returns:
|
|
73
73
|
|
|
74
|
-
|type|description|
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
| type | description |
|
|
75
|
+
| -------- | ------------------------------------------------ |
|
|
76
|
+
| `Set<a>` | An empty set with the given initial storage size |
|
|
77
77
|
|
|
78
78
|
Throws:
|
|
79
79
|
|
|
@@ -96,10 +96,10 @@ Adds a new value to the set. If the value already exists, nothing happens.
|
|
|
96
96
|
|
|
97
97
|
Parameters:
|
|
98
98
|
|
|
99
|
-
|param|type|description|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
| param | type | description |
|
|
100
|
+
| ----- | -------- | ----------------- |
|
|
101
|
+
| `key` | `a` | The value to add |
|
|
102
|
+
| `set` | `Set<a>` | The set to update |
|
|
103
103
|
|
|
104
104
|
### Set.**contains**
|
|
105
105
|
|
|
@@ -116,16 +116,16 @@ Determines if the set contains the given value.
|
|
|
116
116
|
|
|
117
117
|
Parameters:
|
|
118
118
|
|
|
119
|
-
|param|type|description|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
| param | type | description |
|
|
120
|
+
| ----- | -------- | ----------------------- |
|
|
121
|
+
| `key` | `a` | The value to search for |
|
|
122
|
+
| `set` | `Set<a>` | The set to search |
|
|
123
123
|
|
|
124
124
|
Returns:
|
|
125
125
|
|
|
126
|
-
|type|description|
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
| type | description |
|
|
127
|
+
| ------ | --------------------------------------------------------------- |
|
|
128
|
+
| `Bool` | `true` if the set contains the given value or `false` otherwise |
|
|
129
129
|
|
|
130
130
|
### Set.**remove**
|
|
131
131
|
|
|
@@ -142,10 +142,10 @@ Removes the given value from the set. If the value doesn't exist, nothing happen
|
|
|
142
142
|
|
|
143
143
|
Parameters:
|
|
144
144
|
|
|
145
|
-
|param|type|description|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
| param | type | description |
|
|
146
|
+
| ----- | -------- | ------------------- |
|
|
147
|
+
| `key` | `a` | The value to remove |
|
|
148
|
+
| `set` | `Set<a>` | The set to update |
|
|
149
149
|
|
|
150
150
|
### Set.**size**
|
|
151
151
|
|
|
@@ -162,15 +162,15 @@ Provides the count of values within the set.
|
|
|
162
162
|
|
|
163
163
|
Parameters:
|
|
164
164
|
|
|
165
|
-
|param|type|description|
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
| param | type | description |
|
|
166
|
+
| ----- | -------- | ------------------ |
|
|
167
|
+
| `set` | `Set<a>` | The set to inspect |
|
|
168
168
|
|
|
169
169
|
Returns:
|
|
170
170
|
|
|
171
|
-
|type|description|
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
| type | description |
|
|
172
|
+
| -------- | -------------------------------- |
|
|
173
|
+
| `Number` | The count of elements in the set |
|
|
174
174
|
|
|
175
175
|
### Set.**isEmpty**
|
|
176
176
|
|
|
@@ -187,15 +187,15 @@ Determines if the set contains no elements.
|
|
|
187
187
|
|
|
188
188
|
Parameters:
|
|
189
189
|
|
|
190
|
-
|param|type|description|
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
| param | type | description |
|
|
191
|
+
| ----- | -------- | ------------------ |
|
|
192
|
+
| `set` | `Set<a>` | The set to inspect |
|
|
193
193
|
|
|
194
194
|
Returns:
|
|
195
195
|
|
|
196
|
-
|type|description|
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
| type | description |
|
|
197
|
+
| ------ | ----------------------------------------------------- |
|
|
198
|
+
| `Bool` | `true` if the given set is empty or `false` otherwise |
|
|
199
199
|
|
|
200
200
|
### Set.**clear**
|
|
201
201
|
|
|
@@ -212,9 +212,9 @@ Resets the set by removing all values.
|
|
|
212
212
|
|
|
213
213
|
Parameters:
|
|
214
214
|
|
|
215
|
-
|param|type|description|
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
| param | type | description |
|
|
216
|
+
| ----- | -------- | ---------------- |
|
|
217
|
+
| `set` | `Set<a>` | The set to reset |
|
|
218
218
|
|
|
219
219
|
### Set.**forEach**
|
|
220
220
|
|
|
@@ -238,10 +238,10 @@ Iterates the set, calling an iterator function on each element.
|
|
|
238
238
|
|
|
239
239
|
Parameters:
|
|
240
240
|
|
|
241
|
-
|param|type|description|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
| param | type | description |
|
|
242
|
+
| ----- | ----------- | ----------------------------------------------- |
|
|
243
|
+
| `fn` | `a => Void` | The iterator function to call with each element |
|
|
244
|
+
| `set` | `Set<a>` | The set to iterate |
|
|
245
245
|
|
|
246
246
|
### Set.**reduce**
|
|
247
247
|
|
|
@@ -258,17 +258,17 @@ Combines all elements of a set using a reducer function.
|
|
|
258
258
|
|
|
259
259
|
Parameters:
|
|
260
260
|
|
|
261
|
-
|param|type|description|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
| param | type | description |
|
|
262
|
+
| ------ | ------------- | --------------------------------------------------------------------------------------------------------- |
|
|
263
|
+
| `fn` | `(a, b) => a` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
264
|
+
| `init` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
265
|
+
| `set` | `Set<b>` | The set to iterate |
|
|
266
266
|
|
|
267
267
|
Returns:
|
|
268
268
|
|
|
269
|
-
|type|description|
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
| type | description |
|
|
270
|
+
| ---- | ---------------------------------------- |
|
|
271
|
+
| `a` | The final accumulator returned from `fn` |
|
|
272
272
|
|
|
273
273
|
### Set.**filter**
|
|
274
274
|
|
|
@@ -285,10 +285,10 @@ Removes elements from a set where a predicate function returns `false`.
|
|
|
285
285
|
|
|
286
286
|
Parameters:
|
|
287
287
|
|
|
288
|
-
|param|type|description|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
| param | type | description |
|
|
289
|
+
| ----- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
290
|
+
| `fn` | `a => Bool` | The predicate function to indicate which elements to remove from the set, where returning `false` indicates the value should be removed |
|
|
291
|
+
| `set` | `Set<a>` | The set to iterate |
|
|
292
292
|
|
|
293
293
|
### Set.**reject**
|
|
294
294
|
|
|
@@ -305,10 +305,10 @@ Removes elements from a set where a predicate function returns `true`.
|
|
|
305
305
|
|
|
306
306
|
Parameters:
|
|
307
307
|
|
|
308
|
-
|param|type|description|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
| param | type | description |
|
|
309
|
+
| ----- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
310
|
+
| `fn` | `a => Bool` | The predicate function to indicate which elements to remove from the set, where returning `true` indicates the value should be removed |
|
|
311
|
+
| `set` | `Set<a>` | The set to iterate |
|
|
312
312
|
|
|
313
313
|
### Set.**toList**
|
|
314
314
|
|
|
@@ -325,15 +325,15 @@ Converts a set into a list of its elements.
|
|
|
325
325
|
|
|
326
326
|
Parameters:
|
|
327
327
|
|
|
328
|
-
|param|type|description|
|
|
329
|
-
|
|
330
|
-
|
|
328
|
+
| param | type | description |
|
|
329
|
+
| ----- | -------- | ------------------ |
|
|
330
|
+
| `set` | `Set<a>` | The set to convert |
|
|
331
331
|
|
|
332
332
|
Returns:
|
|
333
333
|
|
|
334
|
-
|type|description|
|
|
335
|
-
|
|
336
|
-
|
|
334
|
+
| type | description |
|
|
335
|
+
| --------- | -------------------------------- |
|
|
336
|
+
| `List<a>` | A list containing all set values |
|
|
337
337
|
|
|
338
338
|
### Set.**fromList**
|
|
339
339
|
|
|
@@ -350,15 +350,15 @@ Creates a set from a list.
|
|
|
350
350
|
|
|
351
351
|
Parameters:
|
|
352
352
|
|
|
353
|
-
|param|type|description|
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
| param | type | description |
|
|
354
|
+
| ------ | --------- | ------------------- |
|
|
355
|
+
| `list` | `List<a>` | The list to convert |
|
|
356
356
|
|
|
357
357
|
Returns:
|
|
358
358
|
|
|
359
|
-
|type|description|
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
| type | description |
|
|
360
|
+
| -------- | -------------------------------- |
|
|
361
|
+
| `Set<a>` | A set containing all list values |
|
|
362
362
|
|
|
363
363
|
### Set.**toArray**
|
|
364
364
|
|
|
@@ -375,15 +375,15 @@ Converts a set into an array of its elements.
|
|
|
375
375
|
|
|
376
376
|
Parameters:
|
|
377
377
|
|
|
378
|
-
|param|type|description|
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
| param | type | description |
|
|
379
|
+
| ----- | -------- | ------------------ |
|
|
380
|
+
| `set` | `Set<a>` | The set to convert |
|
|
381
381
|
|
|
382
382
|
Returns:
|
|
383
383
|
|
|
384
|
-
|type|description|
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
| type | description |
|
|
385
|
+
| ---------- | ---------------------------------- |
|
|
386
|
+
| `Array<a>` | An array containing all set values |
|
|
387
387
|
|
|
388
388
|
### Set.**fromArray**
|
|
389
389
|
|
|
@@ -400,15 +400,15 @@ Creates a set from an array.
|
|
|
400
400
|
|
|
401
401
|
Parameters:
|
|
402
402
|
|
|
403
|
-
|param|type|description|
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
| param | type | description |
|
|
404
|
+
| ------- | ---------- | -------------------- |
|
|
405
|
+
| `array` | `Array<a>` | The array to convert |
|
|
406
406
|
|
|
407
407
|
Returns:
|
|
408
408
|
|
|
409
|
-
|type|description|
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
| type | description |
|
|
410
|
+
| -------- | --------------------------------- |
|
|
411
|
+
| `Set<a>` | A set containing all array values |
|
|
412
412
|
|
|
413
413
|
### Set.**union**
|
|
414
414
|
|
|
@@ -425,16 +425,16 @@ Combines two sets into a single set containing all elements from both sets.
|
|
|
425
425
|
|
|
426
426
|
Parameters:
|
|
427
427
|
|
|
428
|
-
|param|type|description|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
428
|
+
| param | type | description |
|
|
429
|
+
| ------ | -------- | ------------------------- |
|
|
430
|
+
| `set1` | `Set<a>` | The first set to combine |
|
|
431
|
+
| `set2` | `Set<a>` | The second set to combine |
|
|
432
432
|
|
|
433
433
|
Returns:
|
|
434
434
|
|
|
435
|
-
|type|description|
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
| type | description |
|
|
436
|
+
| -------- | ------------------------------------------ |
|
|
437
|
+
| `Set<a>` | A set containing all elements of both sets |
|
|
438
438
|
|
|
439
439
|
### Set.**diff**
|
|
440
440
|
|
|
@@ -451,16 +451,16 @@ Combines two sets into a single set containing only the elements not shared betw
|
|
|
451
451
|
|
|
452
452
|
Parameters:
|
|
453
453
|
|
|
454
|
-
|param|type|description|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
454
|
+
| param | type | description |
|
|
455
|
+
| ------ | -------- | ------------------------- |
|
|
456
|
+
| `set1` | `Set<a>` | The first set to combine |
|
|
457
|
+
| `set2` | `Set<a>` | The second set to combine |
|
|
458
458
|
|
|
459
459
|
Returns:
|
|
460
460
|
|
|
461
|
-
|type|description|
|
|
462
|
-
|
|
463
|
-
|
|
461
|
+
| type | description |
|
|
462
|
+
| -------- | ------------------------------------------------------ |
|
|
463
|
+
| `Set<a>` | A set containing only unshared elements from both sets |
|
|
464
464
|
|
|
465
465
|
### Set.**intersect**
|
|
466
466
|
|
|
@@ -477,16 +477,16 @@ Combines two sets into a single set containing only the elements shared between
|
|
|
477
477
|
|
|
478
478
|
Parameters:
|
|
479
479
|
|
|
480
|
-
|param|type|description|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
480
|
+
| param | type | description |
|
|
481
|
+
| ------ | -------- | ------------------------- |
|
|
482
|
+
| `set1` | `Set<a>` | The first set to combine |
|
|
483
|
+
| `set2` | `Set<a>` | The second set to combine |
|
|
484
484
|
|
|
485
485
|
Returns:
|
|
486
486
|
|
|
487
|
-
|type|description|
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
| type | description |
|
|
488
|
+
| -------- | ---------------------------------------------------- |
|
|
489
|
+
| `Set<a>` | A set containing only shared elements from both sets |
|
|
490
490
|
|
|
491
491
|
### Set.**getInternalStats**
|
|
492
492
|
|
|
@@ -510,15 +510,15 @@ Provides data representing the internal state state of the set.
|
|
|
510
510
|
|
|
511
511
|
Parameters:
|
|
512
512
|
|
|
513
|
-
|param|type|description|
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
| param | type | description |
|
|
514
|
+
| ----- | -------- | ------------------ |
|
|
515
|
+
| `set` | `Set<a>` | The set to inspect |
|
|
516
516
|
|
|
517
517
|
Returns:
|
|
518
518
|
|
|
519
|
-
|type|description|
|
|
520
|
-
|
|
521
|
-
|
|
519
|
+
| type | description |
|
|
520
|
+
| ------------------ | ----------------------------- |
|
|
521
|
+
| `InternalSetStats` | The internal state of the set |
|
|
522
522
|
|
|
523
523
|
## Set.Immutable
|
|
524
524
|
|
|
@@ -592,15 +592,15 @@ Provides the count of values within the set.
|
|
|
592
592
|
|
|
593
593
|
Parameters:
|
|
594
594
|
|
|
595
|
-
|param|type|description|
|
|
596
|
-
|
|
597
|
-
|
|
595
|
+
| param | type | description |
|
|
596
|
+
| ----- | -------- | ------------------ |
|
|
597
|
+
| `set` | `Set<a>` | The set to inspect |
|
|
598
598
|
|
|
599
599
|
Returns:
|
|
600
600
|
|
|
601
|
-
|type|description|
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
| type | description |
|
|
602
|
+
| -------- | -------------------------------- |
|
|
603
|
+
| `Number` | The count of elements in the set |
|
|
604
604
|
|
|
605
605
|
#### Set.Immutable.**isEmpty**
|
|
606
606
|
|
|
@@ -624,15 +624,15 @@ Determines if the set contains no elements.
|
|
|
624
624
|
|
|
625
625
|
Parameters:
|
|
626
626
|
|
|
627
|
-
|param|type|description|
|
|
628
|
-
|
|
629
|
-
|
|
627
|
+
| param | type | description |
|
|
628
|
+
| ----- | -------- | ------------------ |
|
|
629
|
+
| `set` | `Set<a>` | The set to inspect |
|
|
630
630
|
|
|
631
631
|
Returns:
|
|
632
632
|
|
|
633
|
-
|type|description|
|
|
634
|
-
|
|
635
|
-
|
|
633
|
+
| type | description |
|
|
634
|
+
| ------ | ----------------------------------------------------- |
|
|
635
|
+
| `Bool` | `true` if the given set is empty or `false` otherwise |
|
|
636
636
|
|
|
637
637
|
#### Set.Immutable.**add**
|
|
638
638
|
|
|
@@ -657,16 +657,16 @@ already exists, the new set will have the same elements as the input set.
|
|
|
657
657
|
|
|
658
658
|
Parameters:
|
|
659
659
|
|
|
660
|
-
|param|type|description|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
660
|
+
| param | type | description |
|
|
661
|
+
| ----- | -------- | ---------------- |
|
|
662
|
+
| `key` | `a` | The value to add |
|
|
663
|
+
| `set` | `Set<a>` | The base set |
|
|
664
664
|
|
|
665
665
|
Returns:
|
|
666
666
|
|
|
667
|
-
|type|description|
|
|
668
|
-
|
|
669
|
-
|
|
667
|
+
| type | description |
|
|
668
|
+
| -------- | ------------------------------------ |
|
|
669
|
+
| `Set<a>` | A new set containing the new element |
|
|
670
670
|
|
|
671
671
|
#### Set.Immutable.**contains**
|
|
672
672
|
|
|
@@ -690,16 +690,16 @@ Determines if the set contains the given value.
|
|
|
690
690
|
|
|
691
691
|
Parameters:
|
|
692
692
|
|
|
693
|
-
|param|type|description|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
693
|
+
| param | type | description |
|
|
694
|
+
| ----- | -------- | ----------------------- |
|
|
695
|
+
| `key` | `a` | The value to search for |
|
|
696
|
+
| `set` | `Set<a>` | The set to search |
|
|
697
697
|
|
|
698
698
|
Returns:
|
|
699
699
|
|
|
700
|
-
|type|description|
|
|
701
|
-
|
|
702
|
-
|
|
700
|
+
| type | description |
|
|
701
|
+
| ------ | --------------------------------------------------------------- |
|
|
702
|
+
| `Bool` | `true` if the set contains the given value or `false` otherwise |
|
|
703
703
|
|
|
704
704
|
#### Set.Immutable.**remove**
|
|
705
705
|
|
|
@@ -724,16 +724,16 @@ the set, the set will be returned unmodified.
|
|
|
724
724
|
|
|
725
725
|
Parameters:
|
|
726
726
|
|
|
727
|
-
|param|type|description|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
727
|
+
| param | type | description |
|
|
728
|
+
| ----- | -------- | ----------------------- |
|
|
729
|
+
| `key` | `a` | The value to exclude |
|
|
730
|
+
| `set` | `Set<a>` | The set to exclude from |
|
|
731
731
|
|
|
732
732
|
Returns:
|
|
733
733
|
|
|
734
|
-
|type|description|
|
|
735
|
-
|
|
736
|
-
|
|
734
|
+
| type | description |
|
|
735
|
+
| -------- | -------------------------------------- |
|
|
736
|
+
| `Set<a>` | A new set without the excluded element |
|
|
737
737
|
|
|
738
738
|
#### Set.Immutable.**forEach**
|
|
739
739
|
|
|
@@ -757,10 +757,10 @@ Iterates the set, calling an iterator function on each element.
|
|
|
757
757
|
|
|
758
758
|
Parameters:
|
|
759
759
|
|
|
760
|
-
|param|type|description|
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
760
|
+
| param | type | description |
|
|
761
|
+
| ----- | ----------- | ----------------------------------------------- |
|
|
762
|
+
| `fn` | `a => Void` | The iterator function to call with each element |
|
|
763
|
+
| `set` | `Set<a>` | The set to iterate |
|
|
764
764
|
|
|
765
765
|
#### Set.Immutable.**reduce**
|
|
766
766
|
|
|
@@ -784,17 +784,17 @@ Combines all elements of a set using a reducer function.
|
|
|
784
784
|
|
|
785
785
|
Parameters:
|
|
786
786
|
|
|
787
|
-
|param|type|description|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
787
|
+
| param | type | description |
|
|
788
|
+
| ------ | ------------- | --------------------------------------------------------------------------------------------------------- |
|
|
789
|
+
| `fn` | `(a, b) => a` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
790
|
+
| `init` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
791
|
+
| `set` | `Set<b>` | The set to iterate |
|
|
792
792
|
|
|
793
793
|
Returns:
|
|
794
794
|
|
|
795
|
-
|type|description|
|
|
796
|
-
|
|
797
|
-
|
|
795
|
+
| type | description |
|
|
796
|
+
| ---- | ---------------------------------------- |
|
|
797
|
+
| `a` | The final accumulator returned from `fn` |
|
|
798
798
|
|
|
799
799
|
#### Set.Immutable.**filter**
|
|
800
800
|
|
|
@@ -818,16 +818,16 @@ Produces a new set without the elements from the input set where a predicate fun
|
|
|
818
818
|
|
|
819
819
|
Parameters:
|
|
820
820
|
|
|
821
|
-
|param|type|description|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
821
|
+
| param | type | description |
|
|
822
|
+
| ----- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
823
|
+
| `fn` | `a => Bool` | The predicate function to indicate which elements to exclude from the set, where returning `false` indicates the value should be excluded |
|
|
824
|
+
| `set` | `Set<a>` | The set to iterate |
|
|
825
825
|
|
|
826
826
|
Returns:
|
|
827
827
|
|
|
828
|
-
|type|description|
|
|
829
|
-
|
|
830
|
-
|
|
828
|
+
| type | description |
|
|
829
|
+
| -------- | ------------------------------------------------------------- |
|
|
830
|
+
| `Set<a>` | A new set excluding the elements not fulfilling the predicate |
|
|
831
831
|
|
|
832
832
|
#### Set.Immutable.**reject**
|
|
833
833
|
|
|
@@ -851,16 +851,16 @@ Produces a new set without the elements from the input set where a predicate fun
|
|
|
851
851
|
|
|
852
852
|
Parameters:
|
|
853
853
|
|
|
854
|
-
|param|type|description|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
854
|
+
| param | type | description |
|
|
855
|
+
| ----- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
856
|
+
| `fn` | `a => Bool` | The predicate function to indicate which elements to exclude from the set, where returning `true` indicates the value should be excluded |
|
|
857
|
+
| `set` | `Set<a>` | The set to iterate |
|
|
858
858
|
|
|
859
859
|
Returns:
|
|
860
860
|
|
|
861
|
-
|type|description|
|
|
862
|
-
|
|
863
|
-
|
|
861
|
+
| type | description |
|
|
862
|
+
| -------- | --------------------------------------------------------- |
|
|
863
|
+
| `Set<a>` | A new set excluding the elements fulfilling the predicate |
|
|
864
864
|
|
|
865
865
|
#### Set.Immutable.**union**
|
|
866
866
|
|
|
@@ -884,16 +884,16 @@ Combines two sets into a single set containing all elements from both sets.
|
|
|
884
884
|
|
|
885
885
|
Parameters:
|
|
886
886
|
|
|
887
|
-
|param|type|description|
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
887
|
+
| param | type | description |
|
|
888
|
+
| ------ | -------- | ------------------------- |
|
|
889
|
+
| `set1` | `Set<a>` | The first set to combine |
|
|
890
|
+
| `set2` | `Set<a>` | The second set to combine |
|
|
891
891
|
|
|
892
892
|
Returns:
|
|
893
893
|
|
|
894
|
-
|type|description|
|
|
895
|
-
|
|
896
|
-
|
|
894
|
+
| type | description |
|
|
895
|
+
| -------- | ------------------------------------------ |
|
|
896
|
+
| `Set<a>` | A set containing all elements of both sets |
|
|
897
897
|
|
|
898
898
|
#### Set.Immutable.**diff**
|
|
899
899
|
|
|
@@ -917,16 +917,16 @@ Combines two sets into a single set containing only the elements not shared betw
|
|
|
917
917
|
|
|
918
918
|
Parameters:
|
|
919
919
|
|
|
920
|
-
|param|type|description|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
920
|
+
| param | type | description |
|
|
921
|
+
| ------ | -------- | ------------------------- |
|
|
922
|
+
| `set1` | `Set<a>` | The first set to combine |
|
|
923
|
+
| `set2` | `Set<a>` | The second set to combine |
|
|
924
924
|
|
|
925
925
|
Returns:
|
|
926
926
|
|
|
927
|
-
|type|description|
|
|
928
|
-
|
|
929
|
-
|
|
927
|
+
| type | description |
|
|
928
|
+
| -------- | ------------------------------------------------------ |
|
|
929
|
+
| `Set<a>` | A set containing only unshared elements from both sets |
|
|
930
930
|
|
|
931
931
|
#### Set.Immutable.**intersect**
|
|
932
932
|
|
|
@@ -950,16 +950,16 @@ Combines two sets into a single set containing only the elements shared between
|
|
|
950
950
|
|
|
951
951
|
Parameters:
|
|
952
952
|
|
|
953
|
-
|param|type|description|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
953
|
+
| param | type | description |
|
|
954
|
+
| ------ | -------- | ------------------------- |
|
|
955
|
+
| `set1` | `Set<a>` | The first set to combine |
|
|
956
|
+
| `set2` | `Set<a>` | The second set to combine |
|
|
957
957
|
|
|
958
958
|
Returns:
|
|
959
959
|
|
|
960
|
-
|type|description|
|
|
961
|
-
|
|
962
|
-
|
|
960
|
+
| type | description |
|
|
961
|
+
| -------- | ---------------------------------------------------- |
|
|
962
|
+
| `Set<a>` | A set containing only shared elements from both sets |
|
|
963
963
|
|
|
964
964
|
#### Set.Immutable.**fromList**
|
|
965
965
|
|
|
@@ -983,15 +983,15 @@ Creates a set from a list.
|
|
|
983
983
|
|
|
984
984
|
Parameters:
|
|
985
985
|
|
|
986
|
-
|param|type|description|
|
|
987
|
-
|
|
988
|
-
|
|
986
|
+
| param | type | description |
|
|
987
|
+
| ------ | --------- | ------------------- |
|
|
988
|
+
| `list` | `List<a>` | The list to convert |
|
|
989
989
|
|
|
990
990
|
Returns:
|
|
991
991
|
|
|
992
|
-
|type|description|
|
|
993
|
-
|
|
994
|
-
|
|
992
|
+
| type | description |
|
|
993
|
+
| -------- | -------------------------------- |
|
|
994
|
+
| `Set<a>` | A set containing all list values |
|
|
995
995
|
|
|
996
996
|
#### Set.Immutable.**toList**
|
|
997
997
|
|
|
@@ -1015,15 +1015,15 @@ Converts a set into a list of its elements.
|
|
|
1015
1015
|
|
|
1016
1016
|
Parameters:
|
|
1017
1017
|
|
|
1018
|
-
|param|type|description|
|
|
1019
|
-
|
|
1020
|
-
|
|
1018
|
+
| param | type | description |
|
|
1019
|
+
| ----- | -------- | ------------------ |
|
|
1020
|
+
| `set` | `Set<a>` | The set to convert |
|
|
1021
1021
|
|
|
1022
1022
|
Returns:
|
|
1023
1023
|
|
|
1024
|
-
|type|description|
|
|
1025
|
-
|
|
1026
|
-
|
|
1024
|
+
| type | description |
|
|
1025
|
+
| --------- | -------------------------------- |
|
|
1026
|
+
| `List<a>` | A list containing all set values |
|
|
1027
1027
|
|
|
1028
1028
|
#### Set.Immutable.**fromArray**
|
|
1029
1029
|
|
|
@@ -1047,15 +1047,15 @@ Creates a set from an array.
|
|
|
1047
1047
|
|
|
1048
1048
|
Parameters:
|
|
1049
1049
|
|
|
1050
|
-
|param|type|description|
|
|
1051
|
-
|
|
1052
|
-
|
|
1050
|
+
| param | type | description |
|
|
1051
|
+
| ------- | ---------- | -------------------- |
|
|
1052
|
+
| `array` | `Array<a>` | The array to convert |
|
|
1053
1053
|
|
|
1054
1054
|
Returns:
|
|
1055
1055
|
|
|
1056
|
-
|type|description|
|
|
1057
|
-
|
|
1058
|
-
|
|
1056
|
+
| type | description |
|
|
1057
|
+
| -------- | --------------------------------- |
|
|
1058
|
+
| `Set<a>` | A set containing all array values |
|
|
1059
1059
|
|
|
1060
1060
|
#### Set.Immutable.**toArray**
|
|
1061
1061
|
|
|
@@ -1079,13 +1079,13 @@ Converts a set into an array of its elements.
|
|
|
1079
1079
|
|
|
1080
1080
|
Parameters:
|
|
1081
1081
|
|
|
1082
|
-
|param|type|description|
|
|
1083
|
-
|
|
1084
|
-
|
|
1082
|
+
| param | type | description |
|
|
1083
|
+
| ----- | -------- | ------------------ |
|
|
1084
|
+
| `set` | `Set<a>` | The set to convert |
|
|
1085
1085
|
|
|
1086
1086
|
Returns:
|
|
1087
1087
|
|
|
1088
|
-
|type|description|
|
|
1089
|
-
|
|
1090
|
-
|
|
1088
|
+
| type | description |
|
|
1089
|
+
| ---------- | ---------------------------------- |
|
|
1090
|
+
| `Array<a>` | An array containing all set values |
|
|
1091
1091
|
|