@grain/stdlib 0.6.6 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/array.gr +55 -7
- package/array.md +606 -560
- package/bigint.md +228 -228
- package/buffer.gr +85 -53
- package/buffer.md +442 -319
- package/bytes.gr +112 -35
- package/bytes.md +299 -219
- package/char.gr +201 -99
- package/char.md +447 -120
- package/exception.gr +11 -11
- package/exception.md +29 -4
- package/float32.gr +327 -3
- package/float32.md +698 -111
- package/float64.gr +320 -3
- package/float64.md +698 -111
- package/fs.gr +1082 -0
- package/fs.md +630 -0
- package/hash.gr +142 -88
- package/hash.md +105 -17
- package/int16.md +178 -178
- package/int32.gr +26 -5
- package/int32.md +266 -231
- package/int64.gr +27 -2
- package/int64.md +266 -231
- package/int8.md +178 -178
- package/json.gr +366 -51
- package/json.md +431 -15
- package/list.gr +328 -31
- package/list.md +759 -336
- package/map.gr +20 -12
- package/map.md +266 -260
- package/marshal.gr +41 -40
- package/marshal.md +14 -14
- package/number.gr +278 -35
- package/number.md +688 -269
- package/option.md +162 -162
- package/package.json +5 -3
- package/path.gr +48 -0
- package/path.md +180 -89
- package/pervasives.gr +2 -2
- package/pervasives.md +275 -275
- package/priorityqueue.gr +7 -7
- package/priorityqueue.md +131 -131
- package/queue.gr +183 -29
- package/queue.md +404 -148
- package/random.md +43 -43
- package/range.gr +4 -4
- package/range.md +42 -42
- package/rational.md +123 -123
- package/regex.gr +52 -51
- package/regex.md +102 -102
- package/result.md +118 -118
- package/runtime/atof/common.md +39 -39
- package/runtime/atof/decimal.gr +6 -6
- package/runtime/atof/decimal.md +14 -14
- package/runtime/atof/lemire.gr +5 -5
- package/runtime/atof/lemire.md +1 -1
- package/runtime/atof/parse.gr +16 -16
- package/runtime/atof/parse.md +2 -2
- package/runtime/atof/slow.md +1 -1
- package/runtime/atof/table.md +2 -2
- package/runtime/atoi/parse.gr +3 -3
- package/runtime/atoi/parse.md +1 -1
- package/runtime/bigint.gr +15 -47
- package/runtime/bigint.md +54 -60
- package/runtime/compare.gr +2 -2
- package/runtime/compare.md +8 -8
- package/runtime/dataStructures.md +211 -211
- package/runtime/debugPrint.gr +4 -1
- package/runtime/debugPrint.md +9 -9
- package/runtime/equal.gr +99 -77
- package/runtime/equal.md +8 -8
- package/runtime/exception.gr +62 -82
- package/runtime/exception.md +62 -11
- package/runtime/gc.gr +39 -45
- package/runtime/gc.md +4 -4
- package/runtime/malloc.gr +7 -7
- package/runtime/malloc.md +13 -13
- package/runtime/math/kernel/cos.gr +70 -0
- package/runtime/math/kernel/cos.md +14 -0
- package/runtime/math/kernel/sin.gr +65 -0
- package/runtime/math/kernel/sin.md +14 -0
- package/runtime/math/kernel/tan.gr +136 -0
- package/runtime/math/kernel/tan.md +14 -0
- package/runtime/math/rempio2.gr +244 -0
- package/runtime/math/rempio2.md +14 -0
- package/runtime/math/trig.gr +130 -0
- package/runtime/math/trig.md +28 -0
- package/runtime/math/umuldi.gr +26 -0
- package/runtime/math/umuldi.md +14 -0
- package/runtime/numberUtils.gr +29 -29
- package/runtime/numberUtils.md +12 -12
- package/runtime/numbers.gr +373 -381
- package/runtime/numbers.md +348 -342
- package/runtime/string.gr +37 -105
- package/runtime/string.md +20 -26
- package/runtime/unsafe/constants.md +24 -24
- package/runtime/unsafe/conv.md +19 -19
- package/runtime/unsafe/memory.gr +24 -20
- package/runtime/unsafe/memory.md +27 -7
- package/runtime/unsafe/offsets.gr +36 -0
- package/runtime/unsafe/offsets.md +88 -0
- package/runtime/unsafe/panic.gr +28 -0
- package/runtime/unsafe/panic.md +14 -0
- package/runtime/unsafe/tags.md +32 -32
- package/runtime/unsafe/wasmf32.md +28 -28
- package/runtime/unsafe/wasmf64.md +28 -28
- package/runtime/unsafe/wasmi32.md +47 -47
- package/runtime/unsafe/wasmi64.md +50 -50
- package/runtime/utf8.gr +189 -0
- package/runtime/utf8.md +117 -0
- package/runtime/wasi.gr +4 -2
- package/runtime/wasi.md +147 -147
- package/set.gr +18 -11
- package/set.md +253 -247
- package/stack.gr +171 -2
- package/stack.md +371 -89
- package/string.gr +352 -557
- package/string.md +298 -255
- package/uint16.md +170 -170
- package/uint32.gr +25 -4
- package/uint32.md +249 -214
- package/uint64.gr +25 -5
- package/uint64.md +249 -214
- package/uint8.md +170 -170
- package/uri.gr +57 -53
- package/uri.md +88 -89
- package/wasi/file.gr +67 -59
- package/wasi/file.md +308 -308
- package/wasi/process.md +26 -26
- package/wasi/random.md +12 -12
- package/wasi/time.md +16 -16
- package/runtime/utils/printing.gr +0 -60
- package/runtime/utils/printing.md +0 -26
package/map.md
CHANGED
|
@@ -55,7 +55,7 @@ Functions and constants included in the Map module.
|
|
|
55
55
|
</details>
|
|
56
56
|
|
|
57
57
|
```grain
|
|
58
|
-
make
|
|
58
|
+
make: (?size: Number) => Map<a, b>
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Creates a new empty map with an initial storage of the given size. As
|
|
@@ -65,15 +65,21 @@ 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
|
+
|
|
78
|
+
Throws:
|
|
79
|
+
|
|
80
|
+
`Failure(String)`
|
|
81
|
+
|
|
82
|
+
* If WASI random_get fails
|
|
77
83
|
|
|
78
84
|
### Map.**set**
|
|
79
85
|
|
|
@@ -83,18 +89,18 @@ No other changes yet.
|
|
|
83
89
|
</details>
|
|
84
90
|
|
|
85
91
|
```grain
|
|
86
|
-
set
|
|
92
|
+
set: (key: a, value: b, map: Map<a, b>) => Void
|
|
87
93
|
```
|
|
88
94
|
|
|
89
95
|
Adds a new key-value pair to the map. If the key already exists in the map, the value is replaced.
|
|
90
96
|
|
|
91
97
|
Parameters:
|
|
92
98
|
|
|
93
|
-
|param|type|description|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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 |
|
|
98
104
|
|
|
99
105
|
### Map.**get**
|
|
100
106
|
|
|
@@ -104,23 +110,23 @@ No other changes yet.
|
|
|
104
110
|
</details>
|
|
105
111
|
|
|
106
112
|
```grain
|
|
107
|
-
get
|
|
113
|
+
get: (key: a, map: Map<a, b>) => Option<b>
|
|
108
114
|
```
|
|
109
115
|
|
|
110
116
|
Retrieves the value for the given key.
|
|
111
117
|
|
|
112
118
|
Parameters:
|
|
113
119
|
|
|
114
|
-
|param|type|description|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
| param | type | description |
|
|
121
|
+
| ----- | ----------- | ----------------- |
|
|
122
|
+
| `key` | `a` | The key to access |
|
|
123
|
+
| `map` | `Map<a, b>` | The map to access |
|
|
118
124
|
|
|
119
125
|
Returns:
|
|
120
126
|
|
|
121
|
-
|type|description|
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
| type | description |
|
|
128
|
+
| ----------- | -------------------------------------------------------------- |
|
|
129
|
+
| `Option<b>` | `Some(value)` if the key exists in the map or `None` otherwise |
|
|
124
130
|
|
|
125
131
|
### Map.**contains**
|
|
126
132
|
|
|
@@ -130,23 +136,23 @@ No other changes yet.
|
|
|
130
136
|
</details>
|
|
131
137
|
|
|
132
138
|
```grain
|
|
133
|
-
contains
|
|
139
|
+
contains: (key: a, map: Map<a, b>) => Bool
|
|
134
140
|
```
|
|
135
141
|
|
|
136
142
|
Determines if the map contains the given key. In such a case, it will always contain a value for the given key.
|
|
137
143
|
|
|
138
144
|
Parameters:
|
|
139
145
|
|
|
140
|
-
|param|type|description|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
| param | type | description |
|
|
147
|
+
| ----- | ----------- | --------------------- |
|
|
148
|
+
| `key` | `a` | The key to search for |
|
|
149
|
+
| `map` | `Map<a, b>` | The map to search |
|
|
144
150
|
|
|
145
151
|
Returns:
|
|
146
152
|
|
|
147
|
-
|type|description|
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
| type | description |
|
|
154
|
+
| ------ | ------------------------------------------------------------- |
|
|
155
|
+
| `Bool` | `true` if the map contains the given key or `false` otherwise |
|
|
150
156
|
|
|
151
157
|
### Map.**remove**
|
|
152
158
|
|
|
@@ -156,17 +162,17 @@ No other changes yet.
|
|
|
156
162
|
</details>
|
|
157
163
|
|
|
158
164
|
```grain
|
|
159
|
-
remove
|
|
165
|
+
remove: (key: a, map: Map<a, b>) => Void
|
|
160
166
|
```
|
|
161
167
|
|
|
162
168
|
Removes the given key from the map, which also removes the value. If the key pair doesn't exist, nothing happens.
|
|
163
169
|
|
|
164
170
|
Parameters:
|
|
165
171
|
|
|
166
|
-
|param|type|description|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
| param | type | description |
|
|
173
|
+
| ----- | ----------- | ----------------- |
|
|
174
|
+
| `key` | `a` | The key to remove |
|
|
175
|
+
| `map` | `Map<a, b>` | The map to update |
|
|
170
176
|
|
|
171
177
|
### Map.**update**
|
|
172
178
|
|
|
@@ -176,18 +182,18 @@ No other changes yet.
|
|
|
176
182
|
</details>
|
|
177
183
|
|
|
178
184
|
```grain
|
|
179
|
-
update
|
|
185
|
+
update: (key: a, fn: (Option<b> => Option<b>), map: Map<a, b>) => Void
|
|
180
186
|
```
|
|
181
187
|
|
|
182
188
|
Updates a value in the map by calling an updater function that receives the previously stored value as an `Option` and returns the new value to be stored as an `Option`. If the key didn't exist previously, the value will be `None`. If `None` is returned from the updater function, the key-value pair is removed.
|
|
183
189
|
|
|
184
190
|
Parameters:
|
|
185
191
|
|
|
186
|
-
|param|type|description|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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 |
|
|
191
197
|
|
|
192
198
|
### Map.**size**
|
|
193
199
|
|
|
@@ -197,22 +203,22 @@ No other changes yet.
|
|
|
197
203
|
</details>
|
|
198
204
|
|
|
199
205
|
```grain
|
|
200
|
-
size
|
|
206
|
+
size: (map: Map<a, b>) => Number
|
|
201
207
|
```
|
|
202
208
|
|
|
203
209
|
Provides the count of key-value pairs stored within the map.
|
|
204
210
|
|
|
205
211
|
Parameters:
|
|
206
212
|
|
|
207
|
-
|param|type|description|
|
|
208
|
-
|
|
209
|
-
|
|
213
|
+
| param | type | description |
|
|
214
|
+
| ----- | ----------- | ------------------ |
|
|
215
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
210
216
|
|
|
211
217
|
Returns:
|
|
212
218
|
|
|
213
|
-
|type|description|
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
| type | description |
|
|
220
|
+
| -------- | --------------------------------------- |
|
|
221
|
+
| `Number` | The count of key-value pairs in the map |
|
|
216
222
|
|
|
217
223
|
### Map.**isEmpty**
|
|
218
224
|
|
|
@@ -222,22 +228,22 @@ No other changes yet.
|
|
|
222
228
|
</details>
|
|
223
229
|
|
|
224
230
|
```grain
|
|
225
|
-
isEmpty
|
|
231
|
+
isEmpty: (map: Map<a, b>) => Bool
|
|
226
232
|
```
|
|
227
233
|
|
|
228
234
|
Determines if the map contains no key-value pairs.
|
|
229
235
|
|
|
230
236
|
Parameters:
|
|
231
237
|
|
|
232
|
-
|param|type|description|
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
| param | type | description |
|
|
239
|
+
| ----- | ----------- | ------------------ |
|
|
240
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
235
241
|
|
|
236
242
|
Returns:
|
|
237
243
|
|
|
238
|
-
|type|description|
|
|
239
|
-
|
|
240
|
-
|
|
244
|
+
| type | description |
|
|
245
|
+
| ------ | ----------------------------------------------------- |
|
|
246
|
+
| `Bool` | `true` if the given map is empty or `false` otherwise |
|
|
241
247
|
|
|
242
248
|
### Map.**clear**
|
|
243
249
|
|
|
@@ -247,16 +253,16 @@ No other changes yet.
|
|
|
247
253
|
</details>
|
|
248
254
|
|
|
249
255
|
```grain
|
|
250
|
-
clear
|
|
256
|
+
clear: (map: Map<a, b>) => Void
|
|
251
257
|
```
|
|
252
258
|
|
|
253
259
|
Resets the map by removing all key-value pairs.
|
|
254
260
|
|
|
255
261
|
Parameters:
|
|
256
262
|
|
|
257
|
-
|param|type|description|
|
|
258
|
-
|
|
259
|
-
|
|
263
|
+
| param | type | description |
|
|
264
|
+
| ----- | ----------- | ---------------- |
|
|
265
|
+
| `map` | `Map<a, b>` | The map to reset |
|
|
260
266
|
|
|
261
267
|
### Map.**forEach**
|
|
262
268
|
|
|
@@ -273,17 +279,17 @@ Parameters:
|
|
|
273
279
|
</details>
|
|
274
280
|
|
|
275
281
|
```grain
|
|
276
|
-
forEach
|
|
282
|
+
forEach: (fn: ((a, b) => Void), map: Map<a, b>) => Void
|
|
277
283
|
```
|
|
278
284
|
|
|
279
285
|
Iterates the map, calling an iterator function with each key and value.
|
|
280
286
|
|
|
281
287
|
Parameters:
|
|
282
288
|
|
|
283
|
-
|param|type|description|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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 |
|
|
287
293
|
|
|
288
294
|
### Map.**reduce**
|
|
289
295
|
|
|
@@ -293,24 +299,24 @@ No other changes yet.
|
|
|
293
299
|
</details>
|
|
294
300
|
|
|
295
301
|
```grain
|
|
296
|
-
reduce
|
|
302
|
+
reduce: (fn: ((a, b, c) => a), init: a, map: Map<b, c>) => a
|
|
297
303
|
```
|
|
298
304
|
|
|
299
305
|
Combines all key-value pairs of a map using a reducer function.
|
|
300
306
|
|
|
301
307
|
Parameters:
|
|
302
308
|
|
|
303
|
-
|param|type|description|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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 |
|
|
308
314
|
|
|
309
315
|
Returns:
|
|
310
316
|
|
|
311
|
-
|type|description|
|
|
312
|
-
|
|
313
|
-
|
|
317
|
+
| type | description |
|
|
318
|
+
| ---- | ---------------------------------------- |
|
|
319
|
+
| `a` | The final accumulator returned from `fn` |
|
|
314
320
|
|
|
315
321
|
### Map.**keys**
|
|
316
322
|
|
|
@@ -320,22 +326,22 @@ No other changes yet.
|
|
|
320
326
|
</details>
|
|
321
327
|
|
|
322
328
|
```grain
|
|
323
|
-
keys
|
|
329
|
+
keys: (map: Map<a, b>) => List<a>
|
|
324
330
|
```
|
|
325
331
|
|
|
326
332
|
Enumerates all keys in the given map.
|
|
327
333
|
|
|
328
334
|
Parameters:
|
|
329
335
|
|
|
330
|
-
|param|type|description|
|
|
331
|
-
|
|
332
|
-
|
|
336
|
+
| param | type | description |
|
|
337
|
+
| ----- | ----------- | -------------------- |
|
|
338
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
333
339
|
|
|
334
340
|
Returns:
|
|
335
341
|
|
|
336
|
-
|type|description|
|
|
337
|
-
|
|
338
|
-
|
|
342
|
+
| type | description |
|
|
343
|
+
| --------- | --------------------------------------------- |
|
|
344
|
+
| `List<a>` | A list containing all keys from the given map |
|
|
339
345
|
|
|
340
346
|
### Map.**values**
|
|
341
347
|
|
|
@@ -345,22 +351,22 @@ No other changes yet.
|
|
|
345
351
|
</details>
|
|
346
352
|
|
|
347
353
|
```grain
|
|
348
|
-
values
|
|
354
|
+
values: (map: Map<a, b>) => List<b>
|
|
349
355
|
```
|
|
350
356
|
|
|
351
357
|
Enumerates all values in the given map.
|
|
352
358
|
|
|
353
359
|
Parameters:
|
|
354
360
|
|
|
355
|
-
|param|type|description|
|
|
356
|
-
|
|
357
|
-
|
|
361
|
+
| param | type | description |
|
|
362
|
+
| ----- | ----------- | -------------------- |
|
|
363
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
358
364
|
|
|
359
365
|
Returns:
|
|
360
366
|
|
|
361
|
-
|type|description|
|
|
362
|
-
|
|
363
|
-
|
|
367
|
+
| type | description |
|
|
368
|
+
| --------- | ----------------------------------------------- |
|
|
369
|
+
| `List<b>` | A list containing all values from the given map |
|
|
364
370
|
|
|
365
371
|
### Map.**toList**
|
|
366
372
|
|
|
@@ -370,22 +376,22 @@ No other changes yet.
|
|
|
370
376
|
</details>
|
|
371
377
|
|
|
372
378
|
```grain
|
|
373
|
-
toList
|
|
379
|
+
toList: (map: Map<a, b>) => List<(a, b)>
|
|
374
380
|
```
|
|
375
381
|
|
|
376
382
|
Enumerates all key-value pairs in the given map.
|
|
377
383
|
|
|
378
384
|
Parameters:
|
|
379
385
|
|
|
380
|
-
|param|type|description|
|
|
381
|
-
|
|
382
|
-
|
|
386
|
+
| param | type | description |
|
|
387
|
+
| ----- | ----------- | -------------------- |
|
|
388
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
383
389
|
|
|
384
390
|
Returns:
|
|
385
391
|
|
|
386
|
-
|type|description|
|
|
387
|
-
|
|
388
|
-
|
|
392
|
+
| type | description |
|
|
393
|
+
| -------------- | -------------------------------------------------------- |
|
|
394
|
+
| `List<(a, b)>` | A list containing all key-value pairs from the given map |
|
|
389
395
|
|
|
390
396
|
### Map.**fromList**
|
|
391
397
|
|
|
@@ -395,22 +401,22 @@ No other changes yet.
|
|
|
395
401
|
</details>
|
|
396
402
|
|
|
397
403
|
```grain
|
|
398
|
-
fromList
|
|
404
|
+
fromList: (list: List<(a, b)>) => Map<a, b>
|
|
399
405
|
```
|
|
400
406
|
|
|
401
407
|
Creates a map from a list.
|
|
402
408
|
|
|
403
409
|
Parameters:
|
|
404
410
|
|
|
405
|
-
|param|type|description|
|
|
406
|
-
|
|
407
|
-
|
|
411
|
+
| param | type | description |
|
|
412
|
+
| ------ | -------------- | ------------------- |
|
|
413
|
+
| `list` | `List<(a, b)>` | The list to convert |
|
|
408
414
|
|
|
409
415
|
Returns:
|
|
410
416
|
|
|
411
|
-
|type|description|
|
|
412
|
-
|
|
413
|
-
|
|
417
|
+
| type | description |
|
|
418
|
+
| ----------- | -------------------------------------------------- |
|
|
419
|
+
| `Map<a, b>` | A map containing all key-value pairs from the list |
|
|
414
420
|
|
|
415
421
|
### Map.**toArray**
|
|
416
422
|
|
|
@@ -420,22 +426,22 @@ No other changes yet.
|
|
|
420
426
|
</details>
|
|
421
427
|
|
|
422
428
|
```grain
|
|
423
|
-
toArray
|
|
429
|
+
toArray: (map: Map<a, b>) => Array<(a, b)>
|
|
424
430
|
```
|
|
425
431
|
|
|
426
432
|
Converts a map into an array of its key-value pairs.
|
|
427
433
|
|
|
428
434
|
Parameters:
|
|
429
435
|
|
|
430
|
-
|param|type|description|
|
|
431
|
-
|
|
432
|
-
|
|
436
|
+
| param | type | description |
|
|
437
|
+
| ----- | ----------- | ------------------ |
|
|
438
|
+
| `map` | `Map<a, b>` | The map to convert |
|
|
433
439
|
|
|
434
440
|
Returns:
|
|
435
441
|
|
|
436
|
-
|type|description|
|
|
437
|
-
|
|
438
|
-
|
|
442
|
+
| type | description |
|
|
443
|
+
| --------------- | ---------------------------------------------------------- |
|
|
444
|
+
| `Array<(a, b)>` | An array containing all key-value pairs from the given map |
|
|
439
445
|
|
|
440
446
|
### Map.**fromArray**
|
|
441
447
|
|
|
@@ -445,22 +451,22 @@ No other changes yet.
|
|
|
445
451
|
</details>
|
|
446
452
|
|
|
447
453
|
```grain
|
|
448
|
-
fromArray
|
|
454
|
+
fromArray: (array: Array<(a, b)>) => Map<a, b>
|
|
449
455
|
```
|
|
450
456
|
|
|
451
457
|
Creates a map from an array.
|
|
452
458
|
|
|
453
459
|
Parameters:
|
|
454
460
|
|
|
455
|
-
|param|type|description|
|
|
456
|
-
|
|
457
|
-
|
|
461
|
+
| param | type | description |
|
|
462
|
+
| ------- | --------------- | -------------------- |
|
|
463
|
+
| `array` | `Array<(a, b)>` | The array to convert |
|
|
458
464
|
|
|
459
465
|
Returns:
|
|
460
466
|
|
|
461
|
-
|type|description|
|
|
462
|
-
|
|
463
|
-
|
|
467
|
+
| type | description |
|
|
468
|
+
| ----------- | --------------------------------------------------- |
|
|
469
|
+
| `Map<a, b>` | A map containing all key-value pairs from the array |
|
|
464
470
|
|
|
465
471
|
### Map.**filter**
|
|
466
472
|
|
|
@@ -470,17 +476,17 @@ No other changes yet.
|
|
|
470
476
|
</details>
|
|
471
477
|
|
|
472
478
|
```grain
|
|
473
|
-
filter
|
|
479
|
+
filter: (fn: ((a, b) => Bool), map: Map<a, b>) => Void
|
|
474
480
|
```
|
|
475
481
|
|
|
476
482
|
Removes key-value pairs from a map where a predicate function returns `false`.
|
|
477
483
|
|
|
478
484
|
Parameters:
|
|
479
485
|
|
|
480
|
-
|param|type|description|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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 |
|
|
484
490
|
|
|
485
491
|
### Map.**reject**
|
|
486
492
|
|
|
@@ -490,17 +496,17 @@ No other changes yet.
|
|
|
490
496
|
</details>
|
|
491
497
|
|
|
492
498
|
```grain
|
|
493
|
-
reject
|
|
499
|
+
reject: (fn: ((a, b) => Bool), map: Map<a, b>) => Void
|
|
494
500
|
```
|
|
495
501
|
|
|
496
502
|
Removes key-value pairs from a map where a predicate function returns `true`.
|
|
497
503
|
|
|
498
504
|
Parameters:
|
|
499
505
|
|
|
500
|
-
|param|type|description|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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 |
|
|
504
510
|
|
|
505
511
|
### Map.**getInternalStats**
|
|
506
512
|
|
|
@@ -517,22 +523,22 @@ Parameters:
|
|
|
517
523
|
</details>
|
|
518
524
|
|
|
519
525
|
```grain
|
|
520
|
-
getInternalStats
|
|
526
|
+
getInternalStats: (map: Map<a, b>) => InternalMapStats
|
|
521
527
|
```
|
|
522
528
|
|
|
523
529
|
Provides data representing the internal state state of the map.
|
|
524
530
|
|
|
525
531
|
Parameters:
|
|
526
532
|
|
|
527
|
-
|param|type|description|
|
|
528
|
-
|
|
529
|
-
|
|
533
|
+
| param | type | description |
|
|
534
|
+
| ----- | ----------- | ------------------ |
|
|
535
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
530
536
|
|
|
531
537
|
Returns:
|
|
532
538
|
|
|
533
|
-
|type|description|
|
|
534
|
-
|
|
535
|
-
|
|
539
|
+
| type | description |
|
|
540
|
+
| ------------------ | ----------------------------- |
|
|
541
|
+
| `InternalMapStats` | The internal state of the map |
|
|
536
542
|
|
|
537
543
|
## Map.Immutable
|
|
538
544
|
|
|
@@ -579,7 +585,7 @@ Functions and constants included in the Map.Immutable module.
|
|
|
579
585
|
</details>
|
|
580
586
|
|
|
581
587
|
```grain
|
|
582
|
-
empty
|
|
588
|
+
empty: Map<a, b>
|
|
583
589
|
```
|
|
584
590
|
|
|
585
591
|
An empty map
|
|
@@ -599,22 +605,22 @@ An empty map
|
|
|
599
605
|
</details>
|
|
600
606
|
|
|
601
607
|
```grain
|
|
602
|
-
size
|
|
608
|
+
size: (map: Map<a, b>) => Number
|
|
603
609
|
```
|
|
604
610
|
|
|
605
611
|
Provides the count of key-value pairs stored within the map.
|
|
606
612
|
|
|
607
613
|
Parameters:
|
|
608
614
|
|
|
609
|
-
|param|type|description|
|
|
610
|
-
|
|
611
|
-
|
|
615
|
+
| param | type | description |
|
|
616
|
+
| ----- | ----------- | ------------------ |
|
|
617
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
612
618
|
|
|
613
619
|
Returns:
|
|
614
620
|
|
|
615
|
-
|type|description|
|
|
616
|
-
|
|
617
|
-
|
|
621
|
+
| type | description |
|
|
622
|
+
| -------- | --------------------------------------- |
|
|
623
|
+
| `Number` | The count of key-value pairs in the map |
|
|
618
624
|
|
|
619
625
|
#### Map.Immutable.**isEmpty**
|
|
620
626
|
|
|
@@ -631,22 +637,22 @@ Returns:
|
|
|
631
637
|
</details>
|
|
632
638
|
|
|
633
639
|
```grain
|
|
634
|
-
isEmpty
|
|
640
|
+
isEmpty: (map: Map<a, b>) => Bool
|
|
635
641
|
```
|
|
636
642
|
|
|
637
643
|
Determines if the map contains no key-value pairs.
|
|
638
644
|
|
|
639
645
|
Parameters:
|
|
640
646
|
|
|
641
|
-
|param|type|description|
|
|
642
|
-
|
|
643
|
-
|
|
647
|
+
| param | type | description |
|
|
648
|
+
| ----- | ----------- | ------------------ |
|
|
649
|
+
| `map` | `Map<a, b>` | The map to inspect |
|
|
644
650
|
|
|
645
651
|
Returns:
|
|
646
652
|
|
|
647
|
-
|type|description|
|
|
648
|
-
|
|
649
|
-
|
|
653
|
+
| type | description |
|
|
654
|
+
| ------ | ----------------------------------------------------- |
|
|
655
|
+
| `Bool` | `true` if the given map is empty or `false` otherwise |
|
|
650
656
|
|
|
651
657
|
#### Map.Immutable.**set**
|
|
652
658
|
|
|
@@ -663,24 +669,24 @@ Returns:
|
|
|
663
669
|
</details>
|
|
664
670
|
|
|
665
671
|
```grain
|
|
666
|
-
set
|
|
672
|
+
set: (key: a, value: b, map: Map<a, b>) => Map<a, b>
|
|
667
673
|
```
|
|
668
674
|
|
|
669
675
|
Produces a new map containing a new key-value pair. If the key already exists in the map, the value is replaced.
|
|
670
676
|
|
|
671
677
|
Parameters:
|
|
672
678
|
|
|
673
|
-
|param|type|description|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
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 |
|
|
678
684
|
|
|
679
685
|
Returns:
|
|
680
686
|
|
|
681
|
-
|type|description|
|
|
682
|
-
|
|
683
|
-
|
|
687
|
+
| type | description |
|
|
688
|
+
| ----------- | ------------------------------------------- |
|
|
689
|
+
| `Map<a, b>` | A new map containing the new key-value pair |
|
|
684
690
|
|
|
685
691
|
#### Map.Immutable.**get**
|
|
686
692
|
|
|
@@ -697,23 +703,23 @@ Returns:
|
|
|
697
703
|
</details>
|
|
698
704
|
|
|
699
705
|
```grain
|
|
700
|
-
get
|
|
706
|
+
get: (key: a, map: Map<a, b>) => Option<b>
|
|
701
707
|
```
|
|
702
708
|
|
|
703
709
|
Retrieves the value for the given key.
|
|
704
710
|
|
|
705
711
|
Parameters:
|
|
706
712
|
|
|
707
|
-
|param|type|description|
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
713
|
+
| param | type | description |
|
|
714
|
+
| ----- | ----------- | ----------------- |
|
|
715
|
+
| `key` | `a` | The key to access |
|
|
716
|
+
| `map` | `Map<a, b>` | The map to access |
|
|
711
717
|
|
|
712
718
|
Returns:
|
|
713
719
|
|
|
714
|
-
|type|description|
|
|
715
|
-
|
|
716
|
-
|
|
720
|
+
| type | description |
|
|
721
|
+
| ----------- | -------------------------------------------------------------- |
|
|
722
|
+
| `Option<b>` | `Some(value)` if the key exists in the map or `None` otherwise |
|
|
717
723
|
|
|
718
724
|
#### Map.Immutable.**contains**
|
|
719
725
|
|
|
@@ -730,23 +736,23 @@ Returns:
|
|
|
730
736
|
</details>
|
|
731
737
|
|
|
732
738
|
```grain
|
|
733
|
-
contains
|
|
739
|
+
contains: (key: a, map: Map<a, b>) => Bool
|
|
734
740
|
```
|
|
735
741
|
|
|
736
742
|
Determines if the map contains the given key. In such a case, it will always contain a value for the given key.
|
|
737
743
|
|
|
738
744
|
Parameters:
|
|
739
745
|
|
|
740
|
-
|param|type|description|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
746
|
+
| param | type | description |
|
|
747
|
+
| ----- | ----------- | --------------------- |
|
|
748
|
+
| `key` | `a` | The key to search for |
|
|
749
|
+
| `map` | `Map<a, b>` | The map to search |
|
|
744
750
|
|
|
745
751
|
Returns:
|
|
746
752
|
|
|
747
|
-
|type|description|
|
|
748
|
-
|
|
749
|
-
|
|
753
|
+
| type | description |
|
|
754
|
+
| ------ | ------------------------------------------------------------- |
|
|
755
|
+
| `Bool` | `true` if the map contains the given key or `false` otherwise |
|
|
750
756
|
|
|
751
757
|
#### Map.Immutable.**remove**
|
|
752
758
|
|
|
@@ -763,7 +769,7 @@ Returns:
|
|
|
763
769
|
</details>
|
|
764
770
|
|
|
765
771
|
```grain
|
|
766
|
-
remove
|
|
772
|
+
remove: (key: a, map: Map<a, b>) => Map<a, b>
|
|
767
773
|
```
|
|
768
774
|
|
|
769
775
|
Produces a new map without the key-value pair corresponding to the given
|
|
@@ -771,16 +777,16 @@ key. If the key doesn't exist in the map, the map will be returned unmodified.
|
|
|
771
777
|
|
|
772
778
|
Parameters:
|
|
773
779
|
|
|
774
|
-
|param|type|description|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
780
|
+
| param | type | description |
|
|
781
|
+
| ----- | ----------- | ----------------------- |
|
|
782
|
+
| `key` | `a` | The key to exclude |
|
|
783
|
+
| `map` | `Map<a, b>` | The map to exclude from |
|
|
778
784
|
|
|
779
785
|
Returns:
|
|
780
786
|
|
|
781
|
-
|type|description|
|
|
782
|
-
|
|
783
|
-
|
|
787
|
+
| type | description |
|
|
788
|
+
| ----------- | ------------------------------- |
|
|
789
|
+
| `Map<a, b>` | A new map without the given key |
|
|
784
790
|
|
|
785
791
|
#### Map.Immutable.**update**
|
|
786
792
|
|
|
@@ -797,7 +803,7 @@ Returns:
|
|
|
797
803
|
</details>
|
|
798
804
|
|
|
799
805
|
```grain
|
|
800
|
-
update
|
|
806
|
+
update: (key: a, fn: (Option<b> => Option<b>), map: Map<a, b>) => Map<a, b>
|
|
801
807
|
```
|
|
802
808
|
|
|
803
809
|
Produces a new map by calling an updater function that receives the
|
|
@@ -808,17 +814,17 @@ key-value pair is excluded.
|
|
|
808
814
|
|
|
809
815
|
Parameters:
|
|
810
816
|
|
|
811
|
-
|param|type|description|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
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 |
|
|
816
822
|
|
|
817
823
|
Returns:
|
|
818
824
|
|
|
819
|
-
|type|description|
|
|
820
|
-
|
|
821
|
-
|
|
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 |
|
|
822
828
|
|
|
823
829
|
#### Map.Immutable.**forEach**
|
|
824
830
|
|
|
@@ -835,17 +841,17 @@ Returns:
|
|
|
835
841
|
</details>
|
|
836
842
|
|
|
837
843
|
```grain
|
|
838
|
-
forEach
|
|
844
|
+
forEach: (fn: ((a, b) => Void), map: Map<a, b>) => Void
|
|
839
845
|
```
|
|
840
846
|
|
|
841
847
|
Iterates the map, calling an iterator function with each key and value.
|
|
842
848
|
|
|
843
849
|
Parameters:
|
|
844
850
|
|
|
845
|
-
|param|type|description|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
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 |
|
|
849
855
|
|
|
850
856
|
#### Map.Immutable.**reduce**
|
|
851
857
|
|
|
@@ -862,24 +868,24 @@ Parameters:
|
|
|
862
868
|
</details>
|
|
863
869
|
|
|
864
870
|
```grain
|
|
865
|
-
reduce
|
|
871
|
+
reduce: (fn: ((a, b, c) => a), init: a, map: Map<b, c>) => a
|
|
866
872
|
```
|
|
867
873
|
|
|
868
874
|
Combines all key-value pairs of a map using a reducer function.
|
|
869
875
|
|
|
870
876
|
Parameters:
|
|
871
877
|
|
|
872
|
-
|param|type|description|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
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 |
|
|
877
883
|
|
|
878
884
|
Returns:
|
|
879
885
|
|
|
880
|
-
|type|description|
|
|
881
|
-
|
|
882
|
-
|
|
886
|
+
| type | description |
|
|
887
|
+
| ---- | ---------------------------------------- |
|
|
888
|
+
| `a` | The final accumulator returned from `fn` |
|
|
883
889
|
|
|
884
890
|
#### Map.Immutable.**keys**
|
|
885
891
|
|
|
@@ -896,22 +902,22 @@ Returns:
|
|
|
896
902
|
</details>
|
|
897
903
|
|
|
898
904
|
```grain
|
|
899
|
-
keys
|
|
905
|
+
keys: (map: Map<a, b>) => List<a>
|
|
900
906
|
```
|
|
901
907
|
|
|
902
908
|
Enumerates all keys in the given map.
|
|
903
909
|
|
|
904
910
|
Parameters:
|
|
905
911
|
|
|
906
|
-
|param|type|description|
|
|
907
|
-
|
|
908
|
-
|
|
912
|
+
| param | type | description |
|
|
913
|
+
| ----- | ----------- | -------------------- |
|
|
914
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
909
915
|
|
|
910
916
|
Returns:
|
|
911
917
|
|
|
912
|
-
|type|description|
|
|
913
|
-
|
|
914
|
-
|
|
918
|
+
| type | description |
|
|
919
|
+
| --------- | --------------------------------------------- |
|
|
920
|
+
| `List<a>` | A list containing all keys from the given map |
|
|
915
921
|
|
|
916
922
|
#### Map.Immutable.**values**
|
|
917
923
|
|
|
@@ -928,22 +934,22 @@ Returns:
|
|
|
928
934
|
</details>
|
|
929
935
|
|
|
930
936
|
```grain
|
|
931
|
-
values
|
|
937
|
+
values: (map: Map<a, b>) => List<b>
|
|
932
938
|
```
|
|
933
939
|
|
|
934
940
|
Enumerates all values in the given map.
|
|
935
941
|
|
|
936
942
|
Parameters:
|
|
937
943
|
|
|
938
|
-
|param|type|description|
|
|
939
|
-
|
|
940
|
-
|
|
944
|
+
| param | type | description |
|
|
945
|
+
| ----- | ----------- | -------------------- |
|
|
946
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
941
947
|
|
|
942
948
|
Returns:
|
|
943
949
|
|
|
944
|
-
|type|description|
|
|
945
|
-
|
|
946
|
-
|
|
950
|
+
| type | description |
|
|
951
|
+
| --------- | ----------------------------------------------- |
|
|
952
|
+
| `List<b>` | A list containing all values from the given map |
|
|
947
953
|
|
|
948
954
|
#### Map.Immutable.**filter**
|
|
949
955
|
|
|
@@ -960,23 +966,23 @@ Returns:
|
|
|
960
966
|
</details>
|
|
961
967
|
|
|
962
968
|
```grain
|
|
963
|
-
filter
|
|
969
|
+
filter: (fn: ((a, b) => Bool), map: Map<a, b>) => Map<a, b>
|
|
964
970
|
```
|
|
965
971
|
|
|
966
972
|
Produces a new map excluding the key-value pairs where a predicate function returns `false`.
|
|
967
973
|
|
|
968
974
|
Parameters:
|
|
969
975
|
|
|
970
|
-
|param|type|description|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
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 |
|
|
974
980
|
|
|
975
981
|
Returns:
|
|
976
982
|
|
|
977
|
-
|type|description|
|
|
978
|
-
|
|
979
|
-
|
|
983
|
+
| type | description |
|
|
984
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
985
|
+
| `Map<a, b>` | A new map excluding the key-value pairs not fulfilling the predicate |
|
|
980
986
|
|
|
981
987
|
#### Map.Immutable.**reject**
|
|
982
988
|
|
|
@@ -993,23 +999,23 @@ Returns:
|
|
|
993
999
|
</details>
|
|
994
1000
|
|
|
995
1001
|
```grain
|
|
996
|
-
reject
|
|
1002
|
+
reject: (fn: ((a, b) => Bool), map: Map<a, b>) => Map<a, b>
|
|
997
1003
|
```
|
|
998
1004
|
|
|
999
1005
|
Produces a new map excluding the key-value pairs where a predicate function returns `true`.
|
|
1000
1006
|
|
|
1001
1007
|
Parameters:
|
|
1002
1008
|
|
|
1003
|
-
|param|type|description|
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
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 |
|
|
1007
1013
|
|
|
1008
1014
|
Returns:
|
|
1009
1015
|
|
|
1010
|
-
|type|description|
|
|
1011
|
-
|
|
1012
|
-
|
|
1016
|
+
| type | description |
|
|
1017
|
+
| ----------- | ---------------------------------------------------------------- |
|
|
1018
|
+
| `Map<a, b>` | A new map excluding the key-value pairs fulfilling the predicate |
|
|
1013
1019
|
|
|
1014
1020
|
#### Map.Immutable.**fromList**
|
|
1015
1021
|
|
|
@@ -1026,22 +1032,22 @@ Returns:
|
|
|
1026
1032
|
</details>
|
|
1027
1033
|
|
|
1028
1034
|
```grain
|
|
1029
|
-
fromList
|
|
1035
|
+
fromList: (list: List<(a, b)>) => Map<a, b>
|
|
1030
1036
|
```
|
|
1031
1037
|
|
|
1032
1038
|
Creates a map from a list.
|
|
1033
1039
|
|
|
1034
1040
|
Parameters:
|
|
1035
1041
|
|
|
1036
|
-
|param|type|description|
|
|
1037
|
-
|
|
1038
|
-
|
|
1042
|
+
| param | type | description |
|
|
1043
|
+
| ------ | -------------- | ------------------- |
|
|
1044
|
+
| `list` | `List<(a, b)>` | The list to convert |
|
|
1039
1045
|
|
|
1040
1046
|
Returns:
|
|
1041
1047
|
|
|
1042
|
-
|type|description|
|
|
1043
|
-
|
|
1044
|
-
|
|
1048
|
+
| type | description |
|
|
1049
|
+
| ----------- | -------------------------------------------------- |
|
|
1050
|
+
| `Map<a, b>` | A map containing all key-value pairs from the list |
|
|
1045
1051
|
|
|
1046
1052
|
#### Map.Immutable.**toList**
|
|
1047
1053
|
|
|
@@ -1058,22 +1064,22 @@ Returns:
|
|
|
1058
1064
|
</details>
|
|
1059
1065
|
|
|
1060
1066
|
```grain
|
|
1061
|
-
toList
|
|
1067
|
+
toList: (map: Map<a, b>) => List<(a, b)>
|
|
1062
1068
|
```
|
|
1063
1069
|
|
|
1064
1070
|
Enumerates all key-value pairs in the given map.
|
|
1065
1071
|
|
|
1066
1072
|
Parameters:
|
|
1067
1073
|
|
|
1068
|
-
|param|type|description|
|
|
1069
|
-
|
|
1070
|
-
|
|
1074
|
+
| param | type | description |
|
|
1075
|
+
| ----- | ----------- | -------------------- |
|
|
1076
|
+
| `map` | `Map<a, b>` | The map to enumerate |
|
|
1071
1077
|
|
|
1072
1078
|
Returns:
|
|
1073
1079
|
|
|
1074
|
-
|type|description|
|
|
1075
|
-
|
|
1076
|
-
|
|
1080
|
+
| type | description |
|
|
1081
|
+
| -------------- | -------------------------------------------------------- |
|
|
1082
|
+
| `List<(a, b)>` | A list containing all key-value pairs from the given map |
|
|
1077
1083
|
|
|
1078
1084
|
#### Map.Immutable.**fromArray**
|
|
1079
1085
|
|
|
@@ -1090,22 +1096,22 @@ Returns:
|
|
|
1090
1096
|
</details>
|
|
1091
1097
|
|
|
1092
1098
|
```grain
|
|
1093
|
-
fromArray
|
|
1099
|
+
fromArray: (array: Array<(a, b)>) => Map<a, b>
|
|
1094
1100
|
```
|
|
1095
1101
|
|
|
1096
1102
|
Creates a map from an array.
|
|
1097
1103
|
|
|
1098
1104
|
Parameters:
|
|
1099
1105
|
|
|
1100
|
-
|param|type|description|
|
|
1101
|
-
|
|
1102
|
-
|
|
1106
|
+
| param | type | description |
|
|
1107
|
+
| ------- | --------------- | -------------------- |
|
|
1108
|
+
| `array` | `Array<(a, b)>` | The array to convert |
|
|
1103
1109
|
|
|
1104
1110
|
Returns:
|
|
1105
1111
|
|
|
1106
|
-
|type|description|
|
|
1107
|
-
|
|
1108
|
-
|
|
1112
|
+
| type | description |
|
|
1113
|
+
| ----------- | --------------------------------------------------- |
|
|
1114
|
+
| `Map<a, b>` | A map containing all key-value pairs from the array |
|
|
1109
1115
|
|
|
1110
1116
|
#### Map.Immutable.**toArray**
|
|
1111
1117
|
|
|
@@ -1122,20 +1128,20 @@ Returns:
|
|
|
1122
1128
|
</details>
|
|
1123
1129
|
|
|
1124
1130
|
```grain
|
|
1125
|
-
toArray
|
|
1131
|
+
toArray: (map: Map<a, b>) => Array<(a, b)>
|
|
1126
1132
|
```
|
|
1127
1133
|
|
|
1128
1134
|
Converts a map into an array of its key-value pairs.
|
|
1129
1135
|
|
|
1130
1136
|
Parameters:
|
|
1131
1137
|
|
|
1132
|
-
|param|type|description|
|
|
1133
|
-
|
|
1134
|
-
|
|
1138
|
+
| param | type | description |
|
|
1139
|
+
| ----- | ----------- | ------------------ |
|
|
1140
|
+
| `map` | `Map<a, b>` | The map to convert |
|
|
1135
1141
|
|
|
1136
1142
|
Returns:
|
|
1137
1143
|
|
|
1138
|
-
|type|description|
|
|
1139
|
-
|
|
1140
|
-
|
|
1144
|
+
| type | description |
|
|
1145
|
+
| --------------- | ---------------------------------------------------------- |
|
|
1146
|
+
| `Array<(a, b)>` | An array containing all key-value pairs from the given map |
|
|
1141
1147
|
|