@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/map.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 map |
|
|
71
71
|
|
|
72
72
|
Returns:
|
|
73
73
|
|
|
74
|
-
|type|description|
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
| type | description |
|
|
75
|
+
| ----------- | ------------------------------------------------ |
|
|
76
|
+
| `Map<a, b>` | An empty map with the given initial storage size |
|
|
77
77
|
|
|
78
78
|
Throws:
|
|
79
79
|
|
|
@@ -96,11 +96,11 @@ Adds a new key-value pair to the map. If the key already exists in the map, the
|
|
|
96
96
|
|
|
97
97
|
Parameters:
|
|
98
98
|
|
|
99
|
-
|param|type|description|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
| param | type | description |
|
|
100
|
+
| ------- | ----------- | ------------------------- |
|
|
101
|
+
| `key` | `a` | The unique key in the map |
|
|
102
|
+
| `value` | `b` | The value to store |
|
|
103
|
+
| `map` | `Map<a, b>` | The map to modify |
|
|
104
104
|
|
|
105
105
|
### Map.**get**
|
|
106
106
|
|
|
@@ -117,16 +117,16 @@ Retrieves the value for the given key.
|
|
|
117
117
|
|
|
118
118
|
Parameters:
|
|
119
119
|
|
|
120
|
-
|param|type|description|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
| param | type | description |
|
|
121
|
+
| ----- | ----------- | ----------------- |
|
|
122
|
+
| `key` | `a` | The key to access |
|
|
123
|
+
| `map` | `Map<a, b>` | The map to access |
|
|
124
124
|
|
|
125
125
|
Returns:
|
|
126
126
|
|
|
127
|
-
|type|description|
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
| type | description |
|
|
128
|
+
| ----------- | -------------------------------------------------------------- |
|
|
129
|
+
| `Option<b>` | `Some(value)` if the key exists in the map or `None` otherwise |
|
|
130
130
|
|
|
131
131
|
### Map.**contains**
|
|
132
132
|
|
|
@@ -143,16 +143,16 @@ Determines if the map contains the given key. In such a case, it will always con
|
|
|
143
143
|
|
|
144
144
|
Parameters:
|
|
145
145
|
|
|
146
|
-
|param|type|description|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
| param | type | description |
|
|
147
|
+
| ----- | ----------- | --------------------- |
|
|
148
|
+
| `key` | `a` | The key to search for |
|
|
149
|
+
| `map` | `Map<a, b>` | The map to search |
|
|
150
150
|
|
|
151
151
|
Returns:
|
|
152
152
|
|
|
153
|
-
|type|description|
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
| type | description |
|
|
154
|
+
| ------ | ------------------------------------------------------------- |
|
|
155
|
+
| `Bool` | `true` if the map contains the given key or `false` otherwise |
|
|
156
156
|
|
|
157
157
|
### Map.**remove**
|
|
158
158
|
|
|
@@ -169,10 +169,10 @@ Removes the given key from the map, which also removes the value. If the key pai
|
|
|
169
169
|
|
|
170
170
|
Parameters:
|
|
171
171
|
|
|
172
|
-
|param|type|description|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
| param | type | description |
|
|
173
|
+
| ----- | ----------- | ----------------- |
|
|
174
|
+
| `key` | `a` | The key to remove |
|
|
175
|
+
| `map` | `Map<a, b>` | The map to update |
|
|
176
176
|
|
|
177
177
|
### Map.**update**
|
|
178
178
|
|
|
@@ -189,11 +189,11 @@ Updates a value in the map by calling an updater function that receives the prev
|
|
|
189
189
|
|
|
190
190
|
Parameters:
|
|
191
191
|
|
|
192
|
-
|param|type|description|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
| param | type | description |
|
|
193
|
+
| ----- | ------------------------ | ------------------------- |
|
|
194
|
+
| `key` | `a` | The unique key in the map |
|
|
195
|
+
| `fn` | `Option<b> => Option<b>` | The updater function |
|
|
196
|
+
| `map` | `Map<a, b>` | The map to modify |
|
|
197
197
|
|
|
198
198
|
### Map.**size**
|
|
199
199
|
|
|
@@ -210,15 +210,15 @@ Provides the count of key-value pairs stored within the map.
|
|
|
210
210
|
|
|
211
211
|
Parameters:
|
|
212
212
|
|
|
213
|
-
|param|type|description|
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
| param | type | description |
|
|
214
|
+
| ----- | ----------- | ------------------ |
|
|
215
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
216
216
|
|
|
217
217
|
Returns:
|
|
218
218
|
|
|
219
|
-
|type|description|
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
| type | description |
|
|
220
|
+
| -------- | --------------------------------------- |
|
|
221
|
+
| `Number` | The count of key-value pairs in the map |
|
|
222
222
|
|
|
223
223
|
### Map.**isEmpty**
|
|
224
224
|
|
|
@@ -235,15 +235,15 @@ Determines if the map contains no key-value pairs.
|
|
|
235
235
|
|
|
236
236
|
Parameters:
|
|
237
237
|
|
|
238
|
-
|param|type|description|
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
| param | type | description |
|
|
239
|
+
| ----- | ----------- | ------------------ |
|
|
240
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
241
241
|
|
|
242
242
|
Returns:
|
|
243
243
|
|
|
244
|
-
|type|description|
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
| type | description |
|
|
245
|
+
| ------ | ----------------------------------------------------- |
|
|
246
|
+
| `Bool` | `true` if the given map is empty or `false` otherwise |
|
|
247
247
|
|
|
248
248
|
### Map.**clear**
|
|
249
249
|
|
|
@@ -260,9 +260,9 @@ Resets the map by removing all key-value pairs.
|
|
|
260
260
|
|
|
261
261
|
Parameters:
|
|
262
262
|
|
|
263
|
-
|param|type|description|
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
| param | type | description |
|
|
264
|
+
| ----- | ----------- | ---------------- |
|
|
265
|
+
| `map` | `Map<a, b>` | The map to reset |
|
|
266
266
|
|
|
267
267
|
### Map.**forEach**
|
|
268
268
|
|
|
@@ -286,10 +286,10 @@ Iterates the map, calling an iterator function with each key and value.
|
|
|
286
286
|
|
|
287
287
|
Parameters:
|
|
288
288
|
|
|
289
|
-
|param|type|description|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
| param | type | description |
|
|
290
|
+
| ----- | ---------------- | ----------------------------------------------------- |
|
|
291
|
+
| `fn` | `(a, b) => Void` | The iterator function to call with each key and value |
|
|
292
|
+
| `map` | `Map<a, b>` | The map to iterate |
|
|
293
293
|
|
|
294
294
|
### Map.**reduce**
|
|
295
295
|
|
|
@@ -306,17 +306,17 @@ Combines all key-value pairs of a map using a reducer function.
|
|
|
306
306
|
|
|
307
307
|
Parameters:
|
|
308
308
|
|
|
309
|
-
|param|type|description|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
| param | type | description |
|
|
310
|
+
| ------ | ---------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
311
|
+
| `fn` | `(a, b, c) => a` | The reducer function to call on each key and value, where the value returned will be the next accumulator value |
|
|
312
|
+
| `init` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
313
|
+
| `map` | `Map<b, c>` | The map to iterate |
|
|
314
314
|
|
|
315
315
|
Returns:
|
|
316
316
|
|
|
317
|
-
|type|description|
|
|
318
|
-
|
|
319
|
-
|
|
317
|
+
| type | description |
|
|
318
|
+
| ---- | ---------------------------------------- |
|
|
319
|
+
| `a` | The final accumulator returned from `fn` |
|
|
320
320
|
|
|
321
321
|
### Map.**keys**
|
|
322
322
|
|
|
@@ -333,15 +333,15 @@ Enumerates all keys in the given map.
|
|
|
333
333
|
|
|
334
334
|
Parameters:
|
|
335
335
|
|
|
336
|
-
|param|type|description|
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
| param | type | description |
|
|
337
|
+
| ----- | ----------- | -------------------- |
|
|
338
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
339
339
|
|
|
340
340
|
Returns:
|
|
341
341
|
|
|
342
|
-
|type|description|
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
| type | description |
|
|
343
|
+
| --------- | --------------------------------------------- |
|
|
344
|
+
| `List<a>` | A list containing all keys from the given map |
|
|
345
345
|
|
|
346
346
|
### Map.**values**
|
|
347
347
|
|
|
@@ -358,15 +358,15 @@ Enumerates all values in the given map.
|
|
|
358
358
|
|
|
359
359
|
Parameters:
|
|
360
360
|
|
|
361
|
-
|param|type|description|
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
| param | type | description |
|
|
362
|
+
| ----- | ----------- | -------------------- |
|
|
363
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
364
364
|
|
|
365
365
|
Returns:
|
|
366
366
|
|
|
367
|
-
|type|description|
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
| type | description |
|
|
368
|
+
| --------- | ----------------------------------------------- |
|
|
369
|
+
| `List<b>` | A list containing all values from the given map |
|
|
370
370
|
|
|
371
371
|
### Map.**toList**
|
|
372
372
|
|
|
@@ -383,15 +383,15 @@ Enumerates all key-value pairs in the given map.
|
|
|
383
383
|
|
|
384
384
|
Parameters:
|
|
385
385
|
|
|
386
|
-
|param|type|description|
|
|
387
|
-
|
|
388
|
-
|
|
386
|
+
| param | type | description |
|
|
387
|
+
| ----- | ----------- | -------------------- |
|
|
388
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
389
389
|
|
|
390
390
|
Returns:
|
|
391
391
|
|
|
392
|
-
|type|description|
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
| type | description |
|
|
393
|
+
| -------------- | -------------------------------------------------------- |
|
|
394
|
+
| `List<(a, b)>` | A list containing all key-value pairs from the given map |
|
|
395
395
|
|
|
396
396
|
### Map.**fromList**
|
|
397
397
|
|
|
@@ -408,15 +408,15 @@ Creates a map from a list.
|
|
|
408
408
|
|
|
409
409
|
Parameters:
|
|
410
410
|
|
|
411
|
-
|param|type|description|
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
| param | type | description |
|
|
412
|
+
| ------ | -------------- | ------------------- |
|
|
413
|
+
| `list` | `List<(a, b)>` | The list to convert |
|
|
414
414
|
|
|
415
415
|
Returns:
|
|
416
416
|
|
|
417
|
-
|type|description|
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
| type | description |
|
|
418
|
+
| ----------- | -------------------------------------------------- |
|
|
419
|
+
| `Map<a, b>` | A map containing all key-value pairs from the list |
|
|
420
420
|
|
|
421
421
|
### Map.**toArray**
|
|
422
422
|
|
|
@@ -433,15 +433,15 @@ Converts a map into an array of its key-value pairs.
|
|
|
433
433
|
|
|
434
434
|
Parameters:
|
|
435
435
|
|
|
436
|
-
|param|type|description|
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
| param | type | description |
|
|
437
|
+
| ----- | ----------- | ------------------ |
|
|
438
|
+
| `map` | `Map<a, b>` | The map to convert |
|
|
439
439
|
|
|
440
440
|
Returns:
|
|
441
441
|
|
|
442
|
-
|type|description|
|
|
443
|
-
|
|
444
|
-
|
|
442
|
+
| type | description |
|
|
443
|
+
| --------------- | ---------------------------------------------------------- |
|
|
444
|
+
| `Array<(a, b)>` | An array containing all key-value pairs from the given map |
|
|
445
445
|
|
|
446
446
|
### Map.**fromArray**
|
|
447
447
|
|
|
@@ -458,15 +458,15 @@ Creates a map from an array.
|
|
|
458
458
|
|
|
459
459
|
Parameters:
|
|
460
460
|
|
|
461
|
-
|param|type|description|
|
|
462
|
-
|
|
463
|
-
|
|
461
|
+
| param | type | description |
|
|
462
|
+
| ------- | --------------- | -------------------- |
|
|
463
|
+
| `array` | `Array<(a, b)>` | The array to convert |
|
|
464
464
|
|
|
465
465
|
Returns:
|
|
466
466
|
|
|
467
|
-
|type|description|
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
| type | description |
|
|
468
|
+
| ----------- | --------------------------------------------------- |
|
|
469
|
+
| `Map<a, b>` | A map containing all key-value pairs from the array |
|
|
470
470
|
|
|
471
471
|
### Map.**filter**
|
|
472
472
|
|
|
@@ -483,10 +483,10 @@ Removes key-value pairs from a map where a predicate function returns `false`.
|
|
|
483
483
|
|
|
484
484
|
Parameters:
|
|
485
485
|
|
|
486
|
-
|param|type|description|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
| param | type | description |
|
|
487
|
+
| ----- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
488
|
+
| `fn` | `(a, b) => Bool` | The predicate function to indicate which key-value pairs to remove from the map, where returning `false` indicates the key-value pair should be removed |
|
|
489
|
+
| `map` | `Map<a, b>` | The map to iterate |
|
|
490
490
|
|
|
491
491
|
### Map.**reject**
|
|
492
492
|
|
|
@@ -503,10 +503,10 @@ Removes key-value pairs from a map where a predicate function returns `true`.
|
|
|
503
503
|
|
|
504
504
|
Parameters:
|
|
505
505
|
|
|
506
|
-
|param|type|description|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
506
|
+
| param | type | description |
|
|
507
|
+
| ----- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
508
|
+
| `fn` | `(a, b) => Bool` | The predicate function to indicate which key-value pairs to remove from the map, where returning `true` indicates the key-value pair should be removed |
|
|
509
|
+
| `map` | `Map<a, b>` | The map to iterate |
|
|
510
510
|
|
|
511
511
|
### Map.**getInternalStats**
|
|
512
512
|
|
|
@@ -530,15 +530,15 @@ Provides data representing the internal state state of the map.
|
|
|
530
530
|
|
|
531
531
|
Parameters:
|
|
532
532
|
|
|
533
|
-
|param|type|description|
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
| param | type | description |
|
|
534
|
+
| ----- | ----------- | ------------------ |
|
|
535
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
536
536
|
|
|
537
537
|
Returns:
|
|
538
538
|
|
|
539
|
-
|type|description|
|
|
540
|
-
|
|
541
|
-
|
|
539
|
+
| type | description |
|
|
540
|
+
| ------------------ | ----------------------------- |
|
|
541
|
+
| `InternalMapStats` | The internal state of the map |
|
|
542
542
|
|
|
543
543
|
## Map.Immutable
|
|
544
544
|
|
|
@@ -612,15 +612,15 @@ Provides the count of key-value pairs stored within the map.
|
|
|
612
612
|
|
|
613
613
|
Parameters:
|
|
614
614
|
|
|
615
|
-
|param|type|description|
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
| param | type | description |
|
|
616
|
+
| ----- | ----------- | ------------------ |
|
|
617
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
618
618
|
|
|
619
619
|
Returns:
|
|
620
620
|
|
|
621
|
-
|type|description|
|
|
622
|
-
|
|
623
|
-
|
|
621
|
+
| type | description |
|
|
622
|
+
| -------- | --------------------------------------- |
|
|
623
|
+
| `Number` | The count of key-value pairs in the map |
|
|
624
624
|
|
|
625
625
|
#### Map.Immutable.**isEmpty**
|
|
626
626
|
|
|
@@ -644,15 +644,15 @@ Determines if the map contains no key-value pairs.
|
|
|
644
644
|
|
|
645
645
|
Parameters:
|
|
646
646
|
|
|
647
|
-
|param|type|description|
|
|
648
|
-
|
|
649
|
-
|
|
647
|
+
| param | type | description |
|
|
648
|
+
| ----- | ----------- | ------------------ |
|
|
649
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
650
650
|
|
|
651
651
|
Returns:
|
|
652
652
|
|
|
653
|
-
|type|description|
|
|
654
|
-
|
|
655
|
-
|
|
653
|
+
| type | description |
|
|
654
|
+
| ------ | ----------------------------------------------------- |
|
|
655
|
+
| `Bool` | `true` if the given map is empty or `false` otherwise |
|
|
656
656
|
|
|
657
657
|
#### Map.Immutable.**set**
|
|
658
658
|
|
|
@@ -676,17 +676,17 @@ Produces a new map containing a new key-value pair. If the key already exists in
|
|
|
676
676
|
|
|
677
677
|
Parameters:
|
|
678
678
|
|
|
679
|
-
|param|type|description|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
679
|
+
| param | type | description |
|
|
680
|
+
| ------- | ----------- | ------------------------- |
|
|
681
|
+
| `key` | `a` | The unique key in the map |
|
|
682
|
+
| `value` | `b` | The value to store |
|
|
683
|
+
| `map` | `Map<a, b>` | The base map |
|
|
684
684
|
|
|
685
685
|
Returns:
|
|
686
686
|
|
|
687
|
-
|type|description|
|
|
688
|
-
|
|
689
|
-
|
|
687
|
+
| type | description |
|
|
688
|
+
| ----------- | ------------------------------------------- |
|
|
689
|
+
| `Map<a, b>` | A new map containing the new key-value pair |
|
|
690
690
|
|
|
691
691
|
#### Map.Immutable.**get**
|
|
692
692
|
|
|
@@ -710,16 +710,16 @@ Retrieves the value for the given key.
|
|
|
710
710
|
|
|
711
711
|
Parameters:
|
|
712
712
|
|
|
713
|
-
|param|type|description|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
713
|
+
| param | type | description |
|
|
714
|
+
| ----- | ----------- | ----------------- |
|
|
715
|
+
| `key` | `a` | The key to access |
|
|
716
|
+
| `map` | `Map<a, b>` | The map to access |
|
|
717
717
|
|
|
718
718
|
Returns:
|
|
719
719
|
|
|
720
|
-
|type|description|
|
|
721
|
-
|
|
722
|
-
|
|
720
|
+
| type | description |
|
|
721
|
+
| ----------- | -------------------------------------------------------------- |
|
|
722
|
+
| `Option<b>` | `Some(value)` if the key exists in the map or `None` otherwise |
|
|
723
723
|
|
|
724
724
|
#### Map.Immutable.**contains**
|
|
725
725
|
|
|
@@ -743,16 +743,16 @@ Determines if the map contains the given key. In such a case, it will always con
|
|
|
743
743
|
|
|
744
744
|
Parameters:
|
|
745
745
|
|
|
746
|
-
|param|type|description|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
746
|
+
| param | type | description |
|
|
747
|
+
| ----- | ----------- | --------------------- |
|
|
748
|
+
| `key` | `a` | The key to search for |
|
|
749
|
+
| `map` | `Map<a, b>` | The map to search |
|
|
750
750
|
|
|
751
751
|
Returns:
|
|
752
752
|
|
|
753
|
-
|type|description|
|
|
754
|
-
|
|
755
|
-
|
|
753
|
+
| type | description |
|
|
754
|
+
| ------ | ------------------------------------------------------------- |
|
|
755
|
+
| `Bool` | `true` if the map contains the given key or `false` otherwise |
|
|
756
756
|
|
|
757
757
|
#### Map.Immutable.**remove**
|
|
758
758
|
|
|
@@ -777,16 +777,16 @@ key. If the key doesn't exist in the map, the map will be returned unmodified.
|
|
|
777
777
|
|
|
778
778
|
Parameters:
|
|
779
779
|
|
|
780
|
-
|param|type|description|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
780
|
+
| param | type | description |
|
|
781
|
+
| ----- | ----------- | ----------------------- |
|
|
782
|
+
| `key` | `a` | The key to exclude |
|
|
783
|
+
| `map` | `Map<a, b>` | The map to exclude from |
|
|
784
784
|
|
|
785
785
|
Returns:
|
|
786
786
|
|
|
787
|
-
|type|description|
|
|
788
|
-
|
|
789
|
-
|
|
787
|
+
| type | description |
|
|
788
|
+
| ----------- | ------------------------------- |
|
|
789
|
+
| `Map<a, b>` | A new map without the given key |
|
|
790
790
|
|
|
791
791
|
#### Map.Immutable.**update**
|
|
792
792
|
|
|
@@ -814,17 +814,17 @@ key-value pair is excluded.
|
|
|
814
814
|
|
|
815
815
|
Parameters:
|
|
816
816
|
|
|
817
|
-
|param|type|description|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
817
|
+
| param | type | description |
|
|
818
|
+
| ----- | ------------------------ | ------------------------- |
|
|
819
|
+
| `key` | `a` | The unique key in the map |
|
|
820
|
+
| `fn` | `Option<b> => Option<b>` | The updater function |
|
|
821
|
+
| `map` | `Map<a, b>` | The base map |
|
|
822
822
|
|
|
823
823
|
Returns:
|
|
824
824
|
|
|
825
|
-
|type|description|
|
|
826
|
-
|
|
827
|
-
|
|
825
|
+
| type | description |
|
|
826
|
+
| ----------- | ------------------------------------------------------------------------------------- |
|
|
827
|
+
| `Map<a, b>` | A new map with the value at the given key modified according to the function's output |
|
|
828
828
|
|
|
829
829
|
#### Map.Immutable.**forEach**
|
|
830
830
|
|
|
@@ -848,10 +848,10 @@ Iterates the map, calling an iterator function with each key and value.
|
|
|
848
848
|
|
|
849
849
|
Parameters:
|
|
850
850
|
|
|
851
|
-
|param|type|description|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
851
|
+
| param | type | description |
|
|
852
|
+
| ----- | ---------------- | ----------------------------------------------------- |
|
|
853
|
+
| `fn` | `(a, b) => Void` | The iterator function to call with each key and value |
|
|
854
|
+
| `map` | `Map<a, b>` | The map to iterate |
|
|
855
855
|
|
|
856
856
|
#### Map.Immutable.**reduce**
|
|
857
857
|
|
|
@@ -875,17 +875,17 @@ Combines all key-value pairs of a map using a reducer function.
|
|
|
875
875
|
|
|
876
876
|
Parameters:
|
|
877
877
|
|
|
878
|
-
|param|type|description|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
878
|
+
| param | type | description |
|
|
879
|
+
| ------ | ---------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
880
|
+
| `fn` | `(a, b, c) => a` | The reducer function to call on each key and value, where the value returned will be the next accumulator value |
|
|
881
|
+
| `init` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
882
|
+
| `map` | `Map<b, c>` | The map to iterate |
|
|
883
883
|
|
|
884
884
|
Returns:
|
|
885
885
|
|
|
886
|
-
|type|description|
|
|
887
|
-
|
|
888
|
-
|
|
886
|
+
| type | description |
|
|
887
|
+
| ---- | ---------------------------------------- |
|
|
888
|
+
| `a` | The final accumulator returned from `fn` |
|
|
889
889
|
|
|
890
890
|
#### Map.Immutable.**keys**
|
|
891
891
|
|
|
@@ -909,15 +909,15 @@ Enumerates all keys in the given map.
|
|
|
909
909
|
|
|
910
910
|
Parameters:
|
|
911
911
|
|
|
912
|
-
|param|type|description|
|
|
913
|
-
|
|
914
|
-
|
|
912
|
+
| param | type | description |
|
|
913
|
+
| ----- | ----------- | -------------------- |
|
|
914
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
915
915
|
|
|
916
916
|
Returns:
|
|
917
917
|
|
|
918
|
-
|type|description|
|
|
919
|
-
|
|
920
|
-
|
|
918
|
+
| type | description |
|
|
919
|
+
| --------- | --------------------------------------------- |
|
|
920
|
+
| `List<a>` | A list containing all keys from the given map |
|
|
921
921
|
|
|
922
922
|
#### Map.Immutable.**values**
|
|
923
923
|
|
|
@@ -941,15 +941,15 @@ Enumerates all values in the given map.
|
|
|
941
941
|
|
|
942
942
|
Parameters:
|
|
943
943
|
|
|
944
|
-
|param|type|description|
|
|
945
|
-
|
|
946
|
-
|
|
944
|
+
| param | type | description |
|
|
945
|
+
| ----- | ----------- | -------------------- |
|
|
946
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
947
947
|
|
|
948
948
|
Returns:
|
|
949
949
|
|
|
950
|
-
|type|description|
|
|
951
|
-
|
|
952
|
-
|
|
950
|
+
| type | description |
|
|
951
|
+
| --------- | ----------------------------------------------- |
|
|
952
|
+
| `List<b>` | A list containing all values from the given map |
|
|
953
953
|
|
|
954
954
|
#### Map.Immutable.**filter**
|
|
955
955
|
|
|
@@ -973,16 +973,16 @@ Produces a new map excluding the key-value pairs where a predicate function retu
|
|
|
973
973
|
|
|
974
974
|
Parameters:
|
|
975
975
|
|
|
976
|
-
|param|type|description|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
976
|
+
| param | type | description |
|
|
977
|
+
| ----- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
978
|
+
| `fn` | `(a, b) => Bool` | The predicate function to indicate which key-value pairs to exclude from the map, where returning `false` indicates the key-value pair should be excluded |
|
|
979
|
+
| `map` | `Map<a, b>` | The map to iterate |
|
|
980
980
|
|
|
981
981
|
Returns:
|
|
982
982
|
|
|
983
|
-
|type|description|
|
|
984
|
-
|
|
985
|
-
|
|
983
|
+
| type | description |
|
|
984
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
985
|
+
| `Map<a, b>` | A new map excluding the key-value pairs not fulfilling the predicate |
|
|
986
986
|
|
|
987
987
|
#### Map.Immutable.**reject**
|
|
988
988
|
|
|
@@ -1006,16 +1006,16 @@ Produces a new map excluding the key-value pairs where a predicate function retu
|
|
|
1006
1006
|
|
|
1007
1007
|
Parameters:
|
|
1008
1008
|
|
|
1009
|
-
|param|type|description|
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1009
|
+
| param | type | description |
|
|
1010
|
+
| ----- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1011
|
+
| `fn` | `(a, b) => Bool` | The predicate function to indicate which key-value pairs to exclude from the map, where returning `true` indicates the key-value pair should be excluded |
|
|
1012
|
+
| `map` | `Map<a, b>` | The map to iterate |
|
|
1013
1013
|
|
|
1014
1014
|
Returns:
|
|
1015
1015
|
|
|
1016
|
-
|type|description|
|
|
1017
|
-
|
|
1018
|
-
|
|
1016
|
+
| type | description |
|
|
1017
|
+
| ----------- | ---------------------------------------------------------------- |
|
|
1018
|
+
| `Map<a, b>` | A new map excluding the key-value pairs fulfilling the predicate |
|
|
1019
1019
|
|
|
1020
1020
|
#### Map.Immutable.**fromList**
|
|
1021
1021
|
|
|
@@ -1039,15 +1039,15 @@ Creates a map from a list.
|
|
|
1039
1039
|
|
|
1040
1040
|
Parameters:
|
|
1041
1041
|
|
|
1042
|
-
|param|type|description|
|
|
1043
|
-
|
|
1044
|
-
|
|
1042
|
+
| param | type | description |
|
|
1043
|
+
| ------ | -------------- | ------------------- |
|
|
1044
|
+
| `list` | `List<(a, b)>` | The list to convert |
|
|
1045
1045
|
|
|
1046
1046
|
Returns:
|
|
1047
1047
|
|
|
1048
|
-
|type|description|
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
| type | description |
|
|
1049
|
+
| ----------- | -------------------------------------------------- |
|
|
1050
|
+
| `Map<a, b>` | A map containing all key-value pairs from the list |
|
|
1051
1051
|
|
|
1052
1052
|
#### Map.Immutable.**toList**
|
|
1053
1053
|
|
|
@@ -1071,15 +1071,15 @@ Enumerates all key-value pairs in the given map.
|
|
|
1071
1071
|
|
|
1072
1072
|
Parameters:
|
|
1073
1073
|
|
|
1074
|
-
|param|type|description|
|
|
1075
|
-
|
|
1076
|
-
|
|
1074
|
+
| param | type | description |
|
|
1075
|
+
| ----- | ----------- | -------------------- |
|
|
1076
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
1077
1077
|
|
|
1078
1078
|
Returns:
|
|
1079
1079
|
|
|
1080
|
-
|type|description|
|
|
1081
|
-
|
|
1082
|
-
|
|
1080
|
+
| type | description |
|
|
1081
|
+
| -------------- | -------------------------------------------------------- |
|
|
1082
|
+
| `List<(a, b)>` | A list containing all key-value pairs from the given map |
|
|
1083
1083
|
|
|
1084
1084
|
#### Map.Immutable.**fromArray**
|
|
1085
1085
|
|
|
@@ -1103,15 +1103,15 @@ Creates a map from an array.
|
|
|
1103
1103
|
|
|
1104
1104
|
Parameters:
|
|
1105
1105
|
|
|
1106
|
-
|param|type|description|
|
|
1107
|
-
|
|
1108
|
-
|
|
1106
|
+
| param | type | description |
|
|
1107
|
+
| ------- | --------------- | -------------------- |
|
|
1108
|
+
| `array` | `Array<(a, b)>` | The array to convert |
|
|
1109
1109
|
|
|
1110
1110
|
Returns:
|
|
1111
1111
|
|
|
1112
|
-
|type|description|
|
|
1113
|
-
|
|
1114
|
-
|
|
1112
|
+
| type | description |
|
|
1113
|
+
| ----------- | --------------------------------------------------- |
|
|
1114
|
+
| `Map<a, b>` | A map containing all key-value pairs from the array |
|
|
1115
1115
|
|
|
1116
1116
|
#### Map.Immutable.**toArray**
|
|
1117
1117
|
|
|
@@ -1135,13 +1135,13 @@ Converts a map into an array of its key-value pairs.
|
|
|
1135
1135
|
|
|
1136
1136
|
Parameters:
|
|
1137
1137
|
|
|
1138
|
-
|param|type|description|
|
|
1139
|
-
|
|
1140
|
-
|
|
1138
|
+
| param | type | description |
|
|
1139
|
+
| ----- | ----------- | ------------------ |
|
|
1140
|
+
| `map` | `Map<a, b>` | The map to convert |
|
|
1141
1141
|
|
|
1142
1142
|
Returns:
|
|
1143
1143
|
|
|
1144
|
-
|type|description|
|
|
1145
|
-
|
|
1146
|
-
|
|
1144
|
+
| type | description |
|
|
1145
|
+
| --------------- | ---------------------------------------------------------- |
|
|
1146
|
+
| `Array<(a, b)>` | An array containing all key-value pairs from the given map |
|
|
1147
1147
|
|