@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/list.md
CHANGED
|
@@ -40,15 +40,15 @@ Creates a new list with all elements in reverse order.
|
|
|
40
40
|
|
|
41
41
|
Parameters:
|
|
42
42
|
|
|
43
|
-
|param|type|description|
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
| param | type | description |
|
|
44
|
+
| ------ | --------- | ------------------- |
|
|
45
|
+
| `list` | `List<a>` | The list to reverse |
|
|
46
46
|
|
|
47
47
|
Returns:
|
|
48
48
|
|
|
49
|
-
|type|description|
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
| type | description |
|
|
50
|
+
| --------- | ------------ |
|
|
51
|
+
| `List<a>` | The new list |
|
|
52
52
|
|
|
53
53
|
### List.**init**
|
|
54
54
|
|
|
@@ -67,16 +67,16 @@ is called with the index of each list element.
|
|
|
67
67
|
|
|
68
68
|
Parameters:
|
|
69
69
|
|
|
70
|
-
|param|type|description|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
| param | type | description |
|
|
71
|
+
| -------- | ------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `length` | `Number` | The length of the new list |
|
|
73
|
+
| `fn` | `Number => a` | The initializer function to call with each index, where the value returned will be used to initialize the element |
|
|
74
74
|
|
|
75
75
|
Returns:
|
|
76
76
|
|
|
77
|
-
|type|description|
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
| type | description |
|
|
78
|
+
| --------- | ------------ |
|
|
79
|
+
| `List<a>` | The new list |
|
|
80
80
|
|
|
81
81
|
Examples:
|
|
82
82
|
|
|
@@ -106,15 +106,15 @@ Computes the length of the input list.
|
|
|
106
106
|
|
|
107
107
|
Parameters:
|
|
108
108
|
|
|
109
|
-
|param|type|description|
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
| param | type | description |
|
|
110
|
+
| ------ | --------- | ------------------- |
|
|
111
|
+
| `list` | `List<a>` | The list to inspect |
|
|
112
112
|
|
|
113
113
|
Returns:
|
|
114
114
|
|
|
115
|
-
|type|description|
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
| type | description |
|
|
116
|
+
| -------- | ---------------------------------- |
|
|
117
|
+
| `Number` | The number of elements in the list |
|
|
118
118
|
|
|
119
119
|
### List.**isEmpty**
|
|
120
120
|
|
|
@@ -131,15 +131,15 @@ Determines if the list contains no elements.
|
|
|
131
131
|
|
|
132
132
|
Parameters:
|
|
133
133
|
|
|
134
|
-
|param|type|description|
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
| param | type | description |
|
|
135
|
+
| ------ | --------- | ------------------- |
|
|
136
|
+
| `list` | `List<a>` | The list to inspect |
|
|
137
137
|
|
|
138
138
|
Returns:
|
|
139
139
|
|
|
140
|
-
|type|description|
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
| type | description |
|
|
141
|
+
| ------ | ------------------------------------------------- |
|
|
142
|
+
| `Bool` | `true` if the list is empty and `false` otherwise |
|
|
143
143
|
|
|
144
144
|
### List.**append**
|
|
145
145
|
|
|
@@ -157,16 +157,16 @@ the elements of the second list.
|
|
|
157
157
|
|
|
158
158
|
Parameters:
|
|
159
159
|
|
|
160
|
-
|param|type|description|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
| param | type | description |
|
|
161
|
+
| ------- | --------- | --------------------------------------------- |
|
|
162
|
+
| `list1` | `List<a>` | The list containing elements to appear first |
|
|
163
|
+
| `list2` | `List<a>` | The list containing elements to appear second |
|
|
164
164
|
|
|
165
165
|
Returns:
|
|
166
166
|
|
|
167
|
-
|type|description|
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
| type | description |
|
|
168
|
+
| --------- | ------------------------------------------------------------------------------- |
|
|
169
|
+
| `List<a>` | The new list containing elements from `list1` followed by elements from `list2` |
|
|
170
170
|
|
|
171
171
|
### List.**contains**
|
|
172
172
|
|
|
@@ -184,16 +184,16 @@ Uses the generic `==` structural equality operator.
|
|
|
184
184
|
|
|
185
185
|
Parameters:
|
|
186
186
|
|
|
187
|
-
|param|type|description|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
| param | type | description |
|
|
188
|
+
| -------- | --------- | -------------------- |
|
|
189
|
+
| `search` | `a` | The value to compare |
|
|
190
|
+
| `list` | `List<a>` | The list to inspect |
|
|
191
191
|
|
|
192
192
|
Returns:
|
|
193
193
|
|
|
194
|
-
|type|description|
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
| type | description |
|
|
195
|
+
| ------ | ----------------------------------------------------------- |
|
|
196
|
+
| `Bool` | `true` if the value exists in the list or `false` otherwise |
|
|
197
197
|
|
|
198
198
|
### List.**reduce**
|
|
199
199
|
|
|
@@ -224,17 +224,17 @@ returned. The accumulator starts with value `initial`.
|
|
|
224
224
|
|
|
225
225
|
Parameters:
|
|
226
226
|
|
|
227
|
-
|param|type|description|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
| param | type | description |
|
|
228
|
+
| --------- | ------------- | --------------------------------------------------------------------------------------------------------- |
|
|
229
|
+
| `fn` | `(a, b) => a` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
230
|
+
| `initial` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
231
|
+
| `list` | `List<b>` | The list to iterate |
|
|
232
232
|
|
|
233
233
|
Returns:
|
|
234
234
|
|
|
235
|
-
|type|description|
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
| type | description |
|
|
236
|
+
| ---- | ---------------------------------------- |
|
|
237
|
+
| `a` | The final accumulator returned from `fn` |
|
|
238
238
|
|
|
239
239
|
Examples:
|
|
240
240
|
|
|
@@ -271,17 +271,17 @@ returned. The accumulator starts with value `initial`.
|
|
|
271
271
|
|
|
272
272
|
Parameters:
|
|
273
273
|
|
|
274
|
-
|param|type|description|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
| param | type | description |
|
|
275
|
+
| --------- | ------------- | --------------------------------------------------------------------------------------------------------- |
|
|
276
|
+
| `fn` | `(a, b) => b` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
277
|
+
| `initial` | `b` | The initial value to use for the accumulator on the first iteration |
|
|
278
|
+
| `list` | `List<a>` | The list to iterate |
|
|
279
279
|
|
|
280
280
|
Returns:
|
|
281
281
|
|
|
282
|
-
|type|description|
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
| type | description |
|
|
283
|
+
| ---- | ---------------------------------------- |
|
|
284
|
+
| `b` | The final accumulator returned from `fn` |
|
|
285
285
|
|
|
286
286
|
Examples:
|
|
287
287
|
|
|
@@ -305,16 +305,16 @@ called on each element of the input list.
|
|
|
305
305
|
|
|
306
306
|
Parameters:
|
|
307
307
|
|
|
308
|
-
|param|type|description|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
| param | type | description |
|
|
309
|
+
| ------ | --------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
310
|
+
| `fn` | `a => b` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
|
|
311
|
+
| `list` | `List<a>` | The list to iterate |
|
|
312
312
|
|
|
313
313
|
Returns:
|
|
314
314
|
|
|
315
|
-
|type|description|
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
| type | description |
|
|
316
|
+
| --------- | ------------------------------- |
|
|
317
|
+
| `List<b>` | The new list with mapped values |
|
|
318
318
|
|
|
319
319
|
### List.**mapi**
|
|
320
320
|
|
|
@@ -332,16 +332,16 @@ called on each element of the input list and its index.
|
|
|
332
332
|
|
|
333
333
|
Parameters:
|
|
334
334
|
|
|
335
|
-
|param|type|description|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
335
|
+
| param | type | description |
|
|
336
|
+
| ------ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
337
|
+
| `fn` | `(a, Number) => b` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
|
|
338
|
+
| `list` | `List<a>` | The list to iterate |
|
|
339
339
|
|
|
340
340
|
Returns:
|
|
341
341
|
|
|
342
|
-
|type|description|
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
| type | description |
|
|
343
|
+
| --------- | ------------------------------- |
|
|
344
|
+
| `List<b>` | The new list with mapped values |
|
|
345
345
|
|
|
346
346
|
### List.**filterMap**
|
|
347
347
|
|
|
@@ -360,16 +360,16 @@ The mapper function can return `None` to exclude the element from the new list.
|
|
|
360
360
|
|
|
361
361
|
Parameters:
|
|
362
362
|
|
|
363
|
-
|param|type|description|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
363
|
+
| param | type | description |
|
|
364
|
+
| ------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
365
|
+
| `fn` | `a => Option<b>` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
|
|
366
|
+
| `list` | `List<a>` | The list to iterate |
|
|
367
367
|
|
|
368
368
|
Returns:
|
|
369
369
|
|
|
370
|
-
|type|description|
|
|
371
|
-
|
|
372
|
-
|
|
370
|
+
| type | description |
|
|
371
|
+
| --------- | ---------------------------------------- |
|
|
372
|
+
| `List<b>` | The new list with filtered mapped values |
|
|
373
373
|
|
|
374
374
|
Examples:
|
|
375
375
|
|
|
@@ -394,16 +394,16 @@ The mapper function can return `None` to exclude the element from the new list.
|
|
|
394
394
|
|
|
395
395
|
Parameters:
|
|
396
396
|
|
|
397
|
-
|param|type|description|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
397
|
+
| param | type | description |
|
|
398
|
+
| ------ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
399
|
+
| `fn` | `(a, Number) => Option<b>` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
|
|
400
|
+
| `list` | `List<a>` | The list to iterate |
|
|
401
401
|
|
|
402
402
|
Returns:
|
|
403
403
|
|
|
404
|
-
|type|description|
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
| type | description |
|
|
405
|
+
| --------- | ---------------------------------------- |
|
|
406
|
+
| `List<b>` | The new list with filtered mapped values |
|
|
407
407
|
|
|
408
408
|
Examples:
|
|
409
409
|
|
|
@@ -433,16 +433,16 @@ of all results.
|
|
|
433
433
|
|
|
434
434
|
Parameters:
|
|
435
435
|
|
|
436
|
-
|param|type|description|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
| param | type | description |
|
|
437
|
+
| ------ | -------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
438
|
+
| `fn` | `a => List<b>` | The function to be called on each element, where the value returned will be a list that gets appended to the new list |
|
|
439
|
+
| `list` | `List<a>` | The list to iterate |
|
|
440
440
|
|
|
441
441
|
Returns:
|
|
442
442
|
|
|
443
|
-
|type|description|
|
|
444
|
-
|
|
445
|
-
|
|
443
|
+
| type | description |
|
|
444
|
+
| --------- | ------------ |
|
|
445
|
+
| `List<b>` | The new list |
|
|
446
446
|
|
|
447
447
|
### List.**every**
|
|
448
448
|
|
|
@@ -460,16 +460,16 @@ elements in the input list.
|
|
|
460
460
|
|
|
461
461
|
Parameters:
|
|
462
462
|
|
|
463
|
-
|param|type|description|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
463
|
+
| param | type | description |
|
|
464
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
465
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
466
|
+
| `list` | `List<a>` | The list to check |
|
|
467
467
|
|
|
468
468
|
Returns:
|
|
469
469
|
|
|
470
|
-
|type|description|
|
|
471
|
-
|
|
472
|
-
|
|
470
|
+
| type | description |
|
|
471
|
+
| ------ | ----------------------------------------------------------------- |
|
|
472
|
+
| `Bool` | `true` if all elements satisfy the condition or `false` otherwise |
|
|
473
473
|
|
|
474
474
|
### List.**some**
|
|
475
475
|
|
|
@@ -487,16 +487,16 @@ once** by an element in the input list.
|
|
|
487
487
|
|
|
488
488
|
Parameters:
|
|
489
489
|
|
|
490
|
-
|param|type|description|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
490
|
+
| param | type | description |
|
|
491
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
492
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
493
|
+
| `list` | `List<a>` | The list to iterate |
|
|
494
494
|
|
|
495
495
|
Returns:
|
|
496
496
|
|
|
497
|
-
|type|description|
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
| type | description |
|
|
498
|
+
| ------ | ------------------------------------------------------------------------- |
|
|
499
|
+
| `Bool` | `true` if one or more elements satisfy the condition or `false` otherwise |
|
|
500
500
|
|
|
501
501
|
### List.**forEach**
|
|
502
502
|
|
|
@@ -513,10 +513,10 @@ Iterates a list, calling an iterator function on each element.
|
|
|
513
513
|
|
|
514
514
|
Parameters:
|
|
515
515
|
|
|
516
|
-
|param|type|description|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
516
|
+
| param | type | description |
|
|
517
|
+
| ------ | ----------- | ----------------------------------------------- |
|
|
518
|
+
| `fn` | `a => Void` | The iterator function to call with each element |
|
|
519
|
+
| `list` | `List<a>` | The list to iterate |
|
|
520
520
|
|
|
521
521
|
### List.**forEachi**
|
|
522
522
|
|
|
@@ -534,10 +534,10 @@ Also passes the index as the second argument to the function.
|
|
|
534
534
|
|
|
535
535
|
Parameters:
|
|
536
536
|
|
|
537
|
-
|param|type|description|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
537
|
+
| param | type | description |
|
|
538
|
+
| ------ | --------------------- | ----------------------------------------------- |
|
|
539
|
+
| `fn` | `(a, Number) => Void` | The iterator function to call with each element |
|
|
540
|
+
| `list` | `List<a>` | The list to iterate |
|
|
541
541
|
|
|
542
542
|
### List.**filter**
|
|
543
543
|
|
|
@@ -556,16 +556,16 @@ the condition.
|
|
|
556
556
|
|
|
557
557
|
Parameters:
|
|
558
558
|
|
|
559
|
-
|param|type|description|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
| param | type | description |
|
|
560
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
561
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
562
|
+
| `list` | `List<a>` | The list to iterate |
|
|
563
563
|
|
|
564
564
|
Returns:
|
|
565
565
|
|
|
566
|
-
|type|description|
|
|
567
|
-
|
|
568
|
-
|
|
566
|
+
| type | description |
|
|
567
|
+
| --------- | ----------------------------------------------------------- |
|
|
568
|
+
| `List<a>` | The new list containing elements where `fn` returned `true` |
|
|
569
569
|
|
|
570
570
|
### List.**filteri**
|
|
571
571
|
|
|
@@ -584,16 +584,16 @@ the condition. Also passes the index to the function.
|
|
|
584
584
|
|
|
585
585
|
Parameters:
|
|
586
586
|
|
|
587
|
-
|param|type|description|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
587
|
+
| param | type | description |
|
|
588
|
+
| ------ | --------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
589
|
+
| `fn` | `(a, Number) => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
590
|
+
| `list` | `List<a>` | The list to iterate |
|
|
591
591
|
|
|
592
592
|
Returns:
|
|
593
593
|
|
|
594
|
-
|type|description|
|
|
595
|
-
|
|
596
|
-
|
|
594
|
+
| type | description |
|
|
595
|
+
| --------- | ----------------------------------------------------------- |
|
|
596
|
+
| `List<a>` | The new list containing elements where `fn` returned `true` |
|
|
597
597
|
|
|
598
598
|
### List.**reject**
|
|
599
599
|
|
|
@@ -612,16 +612,16 @@ the condition.
|
|
|
612
612
|
|
|
613
613
|
Parameters:
|
|
614
614
|
|
|
615
|
-
|param|type|description|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
615
|
+
| param | type | description |
|
|
616
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
617
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
618
|
+
| `list` | `List<a>` | The list to iterate |
|
|
619
619
|
|
|
620
620
|
Returns:
|
|
621
621
|
|
|
622
|
-
|type|description|
|
|
623
|
-
|
|
624
|
-
|
|
622
|
+
| type | description |
|
|
623
|
+
| --------- | ------------------------------------------------------------ |
|
|
624
|
+
| `List<a>` | The new list containing elements where `fn` returned `false` |
|
|
625
625
|
|
|
626
626
|
### List.**head**
|
|
627
627
|
|
|
@@ -648,15 +648,15 @@ the input list or `None` if the list is empty.
|
|
|
648
648
|
|
|
649
649
|
Parameters:
|
|
650
650
|
|
|
651
|
-
|param|type|description|
|
|
652
|
-
|
|
653
|
-
|
|
651
|
+
| param | type | description |
|
|
652
|
+
| ------ | --------- | ------------------ |
|
|
653
|
+
| `list` | `List<a>` | The list to access |
|
|
654
654
|
|
|
655
655
|
Returns:
|
|
656
656
|
|
|
657
|
-
|type|description|
|
|
658
|
-
|
|
659
|
-
|
|
657
|
+
| type | description |
|
|
658
|
+
| ----------- | ----------------------------------------------------------------- |
|
|
659
|
+
| `Option<a>` | `Some(firstElement)` if the list has elements or `None` otherwise |
|
|
660
660
|
|
|
661
661
|
### List.**tail**
|
|
662
662
|
|
|
@@ -683,15 +683,15 @@ the input list or `None` if the list is empty.
|
|
|
683
683
|
|
|
684
684
|
Parameters:
|
|
685
685
|
|
|
686
|
-
|param|type|description|
|
|
687
|
-
|
|
688
|
-
|
|
686
|
+
| param | type | description |
|
|
687
|
+
| ------ | --------- | ------------------ |
|
|
688
|
+
| `list` | `List<a>` | The list to access |
|
|
689
689
|
|
|
690
690
|
Returns:
|
|
691
691
|
|
|
692
|
-
|type|description|
|
|
693
|
-
|
|
694
|
-
|
|
692
|
+
| type | description |
|
|
693
|
+
| ----------------- | --------------------------------------------------------- |
|
|
694
|
+
| `Option<List<a>>` | `Some(tail)` if the list has elements or `None` otherwise |
|
|
695
695
|
|
|
696
696
|
### List.**nth**
|
|
697
697
|
|
|
@@ -717,16 +717,16 @@ or `None` if the index is out-of-bounds or the list is empty.
|
|
|
717
717
|
|
|
718
718
|
Parameters:
|
|
719
719
|
|
|
720
|
-
|param|type|description|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
720
|
+
| param | type | description |
|
|
721
|
+
| ------- | --------- | ------------------- |
|
|
722
|
+
| `index` | `Number` | The index to access |
|
|
723
|
+
| `list` | `List<a>` | The list to access |
|
|
724
724
|
|
|
725
725
|
Returns:
|
|
726
726
|
|
|
727
|
-
|type|description|
|
|
728
|
-
|
|
729
|
-
|
|
727
|
+
| type | description |
|
|
728
|
+
| ----------- | -------------------------------------------------------------------------------- |
|
|
729
|
+
| `Option<a>` | `Some(element)` if the list contains an element at the index or `None` otherwise |
|
|
730
730
|
|
|
731
731
|
### List.**flatten**
|
|
732
732
|
|
|
@@ -743,15 +743,15 @@ Flattens nested lists.
|
|
|
743
743
|
|
|
744
744
|
Parameters:
|
|
745
745
|
|
|
746
|
-
|param|type|description|
|
|
747
|
-
|
|
748
|
-
|
|
746
|
+
| param | type | description |
|
|
747
|
+
| ------ | --------------- | ------------------- |
|
|
748
|
+
| `list` | `List<List<a>>` | The list to flatten |
|
|
749
749
|
|
|
750
750
|
Returns:
|
|
751
751
|
|
|
752
|
-
|type|description|
|
|
753
|
-
|
|
754
|
-
|
|
752
|
+
| type | description |
|
|
753
|
+
| --------- | ------------------------------------------------------- |
|
|
754
|
+
| `List<a>` | A new list containing all nested list elements combined |
|
|
755
755
|
|
|
756
756
|
Examples:
|
|
757
757
|
|
|
@@ -781,17 +781,17 @@ Inserts a new value into a list at the specified index.
|
|
|
781
781
|
|
|
782
782
|
Parameters:
|
|
783
783
|
|
|
784
|
-
|param|type|description|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
784
|
+
| param | type | description |
|
|
785
|
+
| ------- | --------- | ------------------- |
|
|
786
|
+
| `index` | `Number` | The index to update |
|
|
787
|
+
| `value` | `a` | The value to insert |
|
|
788
|
+
| `list` | `List<a>` | The list to update |
|
|
789
789
|
|
|
790
790
|
Returns:
|
|
791
791
|
|
|
792
|
-
|type|description|
|
|
793
|
-
|
|
794
|
-
|
|
792
|
+
| type | description |
|
|
793
|
+
| --------- | ------------ |
|
|
794
|
+
| `List<a>` | The new list |
|
|
795
795
|
|
|
796
796
|
Throws:
|
|
797
797
|
|
|
@@ -822,16 +822,16 @@ Counts the number of elements in a list that satisfy the given condition.
|
|
|
822
822
|
|
|
823
823
|
Parameters:
|
|
824
824
|
|
|
825
|
-
|param|type|description|
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
825
|
+
| param | type | description |
|
|
826
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
827
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
828
|
+
| `list` | `List<a>` | The list to iterate |
|
|
829
829
|
|
|
830
830
|
Returns:
|
|
831
831
|
|
|
832
|
-
|type|description|
|
|
833
|
-
|
|
834
|
-
|
|
832
|
+
| type | description |
|
|
833
|
+
| -------- | ------------------------------------------------------- |
|
|
834
|
+
| `Number` | The total number of elements that satisfy the condition |
|
|
835
835
|
|
|
836
836
|
### List.**part**
|
|
837
837
|
|
|
@@ -848,16 +848,16 @@ Split a list into two, with the first list containing the required number of ele
|
|
|
848
848
|
|
|
849
849
|
Parameters:
|
|
850
850
|
|
|
851
|
-
|param|type|description|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
851
|
+
| param | type | description |
|
|
852
|
+
| ------- | --------- | ------------------------------- |
|
|
853
|
+
| `count` | `Number` | The number of elements required |
|
|
854
|
+
| `list` | `List<a>` | The list to split |
|
|
855
855
|
|
|
856
856
|
Returns:
|
|
857
857
|
|
|
858
|
-
|type|description|
|
|
859
|
-
|
|
860
|
-
|
|
858
|
+
| type | description |
|
|
859
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
860
|
+
| `(List<a>, List<a>)` | Two lists where the first contains exactly the required amount of elements and the second contains any remaining elements |
|
|
861
861
|
|
|
862
862
|
Throws:
|
|
863
863
|
|
|
@@ -892,10 +892,10 @@ specified amount to the right. See examples.
|
|
|
892
892
|
|
|
893
893
|
Parameters:
|
|
894
894
|
|
|
895
|
-
|param|type|description|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
895
|
+
| param | type | description |
|
|
896
|
+
| ------ | --------- | ----------------------------------- |
|
|
897
|
+
| `n` | `Number` | The number of elements to rotate by |
|
|
898
|
+
| `list` | `List<a>` | The list to be rotated |
|
|
899
899
|
|
|
900
900
|
Examples:
|
|
901
901
|
|
|
@@ -935,15 +935,15 @@ Uses the generic `==` structural equality operator.
|
|
|
935
935
|
|
|
936
936
|
Parameters:
|
|
937
937
|
|
|
938
|
-
|param|type|description|
|
|
939
|
-
|
|
940
|
-
|
|
938
|
+
| param | type | description |
|
|
939
|
+
| ------ | --------- | ------------------ |
|
|
940
|
+
| `list` | `List<a>` | The list to filter |
|
|
941
941
|
|
|
942
942
|
Returns:
|
|
943
943
|
|
|
944
|
-
|type|description|
|
|
945
|
-
|
|
946
|
-
|
|
944
|
+
| type | description |
|
|
945
|
+
| --------- | ------------------------------------ |
|
|
946
|
+
| `List<a>` | The new list with only unique values |
|
|
947
947
|
|
|
948
948
|
### List.**zip**
|
|
949
949
|
|
|
@@ -965,16 +965,16 @@ list to have the length of the smaller list.
|
|
|
965
965
|
|
|
966
966
|
Parameters:
|
|
967
967
|
|
|
968
|
-
|param|type|description|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
968
|
+
| param | type | description |
|
|
969
|
+
| ------- | --------- | ------------------------------------------------------- |
|
|
970
|
+
| `list1` | `List<a>` | The list to provide values for the first tuple element |
|
|
971
|
+
| `list2` | `List<b>` | The list to provide values for the second tuple element |
|
|
972
972
|
|
|
973
973
|
Returns:
|
|
974
974
|
|
|
975
|
-
|type|description|
|
|
976
|
-
|
|
977
|
-
|
|
975
|
+
| type | description |
|
|
976
|
+
| -------------- | ------------------------------------------------- |
|
|
977
|
+
| `List<(a, b)>` | The new list containing indexed pairs of `(a, b)` |
|
|
978
978
|
|
|
979
979
|
Examples:
|
|
980
980
|
|
|
@@ -1008,17 +1008,17 @@ list to have the length of the smaller list.
|
|
|
1008
1008
|
|
|
1009
1009
|
Parameters:
|
|
1010
1010
|
|
|
1011
|
-
|param|type|description|
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1011
|
+
| param | type | description |
|
|
1012
|
+
| ------- | ------------- | ---------------------------------------------------------------------------------- |
|
|
1013
|
+
| `fn` | `(a, b) => c` | The function to apply to pairs of elements |
|
|
1014
|
+
| `list1` | `List<a>` | The list whose elements will each be passed to the function as the first argument |
|
|
1015
|
+
| `list2` | `List<b>` | The list whose elements will each be passed to the function as the second argument |
|
|
1016
1016
|
|
|
1017
1017
|
Returns:
|
|
1018
1018
|
|
|
1019
|
-
|type|description|
|
|
1020
|
-
|
|
1021
|
-
|
|
1019
|
+
| type | description |
|
|
1020
|
+
| --------- | --------------------------------------------------------------------------------------------------- |
|
|
1021
|
+
| `List<c>` | The new list containing elements derived from applying the function to pairs of input list elements |
|
|
1022
1022
|
|
|
1023
1023
|
Examples:
|
|
1024
1024
|
|
|
@@ -1045,15 +1045,15 @@ Produces two lists by splitting apart a list of tuples.
|
|
|
1045
1045
|
|
|
1046
1046
|
Parameters:
|
|
1047
1047
|
|
|
1048
|
-
|param|type|description|
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
| param | type | description |
|
|
1049
|
+
| ------ | -------------- | --------------------------- |
|
|
1050
|
+
| `list` | `List<(a, b)>` | The list of tuples to split |
|
|
1051
1051
|
|
|
1052
1052
|
Returns:
|
|
1053
1053
|
|
|
1054
|
-
|type|description|
|
|
1055
|
-
|
|
1056
|
-
|
|
1054
|
+
| type | description |
|
|
1055
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
1056
|
+
| `(List<a>, List<b>)` | An list containing all elements from the first tuple element, and a list containing all elements from the second tuple element |
|
|
1057
1057
|
|
|
1058
1058
|
### List.**drop**
|
|
1059
1059
|
|
|
@@ -1071,16 +1071,16 @@ the beginning of the input list.
|
|
|
1071
1071
|
|
|
1072
1072
|
Parameters:
|
|
1073
1073
|
|
|
1074
|
-
|param|type|description|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1074
|
+
| param | type | description |
|
|
1075
|
+
| ------- | --------- | -------------------------------- |
|
|
1076
|
+
| `count` | `Number` | The amount of elements to remove |
|
|
1077
|
+
| `list` | `List<a>` | The input list |
|
|
1078
1078
|
|
|
1079
1079
|
Returns:
|
|
1080
1080
|
|
|
1081
|
-
|type|description|
|
|
1082
|
-
|
|
1083
|
-
|
|
1081
|
+
| type | description |
|
|
1082
|
+
| --------- | ----------------------------------------- |
|
|
1083
|
+
| `List<a>` | The new list without the dropped elements |
|
|
1084
1084
|
|
|
1085
1085
|
Throws:
|
|
1086
1086
|
|
|
@@ -1105,16 +1105,16 @@ Stops when the predicate function returns `false`.
|
|
|
1105
1105
|
|
|
1106
1106
|
Parameters:
|
|
1107
1107
|
|
|
1108
|
-
|param|type|description|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1108
|
+
| param | type | description |
|
|
1109
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1110
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1111
|
+
| `list` | `List<a>` | The input list |
|
|
1112
1112
|
|
|
1113
1113
|
Returns:
|
|
1114
1114
|
|
|
1115
|
-
|type|description|
|
|
1116
|
-
|
|
1117
|
-
|
|
1115
|
+
| type | description |
|
|
1116
|
+
| --------- | ----------------------------------------- |
|
|
1117
|
+
| `List<a>` | The new list without the dropped elements |
|
|
1118
1118
|
|
|
1119
1119
|
### List.**take**
|
|
1120
1120
|
|
|
@@ -1132,16 +1132,16 @@ the beginning of the input list.
|
|
|
1132
1132
|
|
|
1133
1133
|
Parameters:
|
|
1134
1134
|
|
|
1135
|
-
|param|type|description|
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1135
|
+
| param | type | description |
|
|
1136
|
+
| ------- | --------- | ------------------------------ |
|
|
1137
|
+
| `count` | `Number` | The amount of elements to keep |
|
|
1138
|
+
| `list` | `List<a>` | The input list |
|
|
1139
1139
|
|
|
1140
1140
|
Returns:
|
|
1141
1141
|
|
|
1142
|
-
|type|description|
|
|
1143
|
-
|
|
1144
|
-
|
|
1142
|
+
| type | description |
|
|
1143
|
+
| --------- | ------------------------------------------ |
|
|
1144
|
+
| `List<a>` | The new list containing the taken elements |
|
|
1145
1145
|
|
|
1146
1146
|
Throws:
|
|
1147
1147
|
|
|
@@ -1166,16 +1166,16 @@ Stops when the predicate function returns `false`.
|
|
|
1166
1166
|
|
|
1167
1167
|
Parameters:
|
|
1168
1168
|
|
|
1169
|
-
|param|type|description|
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1169
|
+
| param | type | description |
|
|
1170
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1171
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1172
|
+
| `list` | `List<a>` | The input list |
|
|
1173
1173
|
|
|
1174
1174
|
Returns:
|
|
1175
1175
|
|
|
1176
|
-
|type|description|
|
|
1177
|
-
|
|
1178
|
-
|
|
1176
|
+
| type | description |
|
|
1177
|
+
| --------- | ------------------------------------------ |
|
|
1178
|
+
| `List<a>` | The new list containing the taken elements |
|
|
1179
1179
|
|
|
1180
1180
|
### List.**find**
|
|
1181
1181
|
|
|
@@ -1200,16 +1200,16 @@ Finds the first element in a list that satisfies the given condition.
|
|
|
1200
1200
|
|
|
1201
1201
|
Parameters:
|
|
1202
1202
|
|
|
1203
|
-
|param|type|description|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1203
|
+
| param | type | description |
|
|
1204
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1205
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1206
|
+
| `list` | `List<a>` | The list to search |
|
|
1207
1207
|
|
|
1208
1208
|
Returns:
|
|
1209
1209
|
|
|
1210
|
-
|type|description|
|
|
1211
|
-
|
|
1212
|
-
|
|
1210
|
+
| type | description |
|
|
1211
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
1212
|
+
| `Option<a>` | `Some(element)` containing the first value found or `None` otherwise |
|
|
1213
1213
|
|
|
1214
1214
|
### List.**findIndex**
|
|
1215
1215
|
|
|
@@ -1234,16 +1234,16 @@ Finds the first index in a list where the element satisfies the given condition.
|
|
|
1234
1234
|
|
|
1235
1235
|
Parameters:
|
|
1236
1236
|
|
|
1237
|
-
|param|type|description|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1237
|
+
| param | type | description |
|
|
1238
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1239
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1240
|
+
| `list` | `List<a>` | The list to search |
|
|
1241
1241
|
|
|
1242
1242
|
Returns:
|
|
1243
1243
|
|
|
1244
|
-
|type|description|
|
|
1245
|
-
|
|
1246
|
-
|
|
1244
|
+
| type | description |
|
|
1245
|
+
| ---------------- | --------------------------------------------------------------------------------- |
|
|
1246
|
+
| `Option<Number>` | `Some(index)` containing the index of the first element found or `None` otherwise |
|
|
1247
1247
|
|
|
1248
1248
|
### List.**findMap**
|
|
1249
1249
|
|
|
@@ -1261,16 +1261,16 @@ returns the result of applying a mapper function to it.
|
|
|
1261
1261
|
|
|
1262
1262
|
Parameters:
|
|
1263
1263
|
|
|
1264
|
-
|param|type|description|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1264
|
+
| param | type | description |
|
|
1265
|
+
| ------ | ---------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1266
|
+
| `fn` | `a => Option<b>` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1267
|
+
| `list` | `List<a>` | The list to search |
|
|
1268
1268
|
|
|
1269
1269
|
Returns:
|
|
1270
1270
|
|
|
1271
|
-
|type|description|
|
|
1272
|
-
|
|
1273
|
-
|
|
1271
|
+
| type | description |
|
|
1272
|
+
| ----------- | ------------------------------------------------------------------------------------------ |
|
|
1273
|
+
| `Option<b>` | `Some(mapped)` containing the first value found with the given mapping or `None` otherwise |
|
|
1274
1274
|
|
|
1275
1275
|
Examples:
|
|
1276
1276
|
|
|
@@ -1296,16 +1296,16 @@ all ordered pairs `(a, b)`.
|
|
|
1296
1296
|
|
|
1297
1297
|
Parameters:
|
|
1298
1298
|
|
|
1299
|
-
|param|type|description|
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1299
|
+
| param | type | description |
|
|
1300
|
+
| ------- | --------- | ------------------------------------------------------- |
|
|
1301
|
+
| `list1` | `List<a>` | The list to provide values for the first tuple element |
|
|
1302
|
+
| `list2` | `List<b>` | The list to provide values for the second tuple element |
|
|
1303
1303
|
|
|
1304
1304
|
Returns:
|
|
1305
1305
|
|
|
1306
|
-
|type|description|
|
|
1307
|
-
|
|
1308
|
-
|
|
1306
|
+
| type | description |
|
|
1307
|
+
| -------------- | --------------------------------------------- |
|
|
1308
|
+
| `List<(a, b)>` | The new list containing all pairs of `(a, b)` |
|
|
1309
1309
|
|
|
1310
1310
|
### List.**sub**
|
|
1311
1311
|
|
|
@@ -1323,17 +1323,17 @@ to include.
|
|
|
1323
1323
|
|
|
1324
1324
|
Parameters:
|
|
1325
1325
|
|
|
1326
|
-
|param|type|description|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1326
|
+
| param | type | description |
|
|
1327
|
+
| -------- | --------- | ------------------------------------------------------------- |
|
|
1328
|
+
| `start` | `Number` | The index of the list where the subset will begin (inclusive) |
|
|
1329
|
+
| `length` | `Number` | The amount of elements to be included in the subset |
|
|
1330
|
+
| `list` | `List<a>` | The input list |
|
|
1331
1331
|
|
|
1332
1332
|
Returns:
|
|
1333
1333
|
|
|
1334
|
-
|type|description|
|
|
1335
|
-
|
|
1336
|
-
|
|
1334
|
+
| type | description |
|
|
1335
|
+
| --------- | ---------------------- |
|
|
1336
|
+
| `List<a>` | The subset of the list |
|
|
1337
1337
|
|
|
1338
1338
|
Throws:
|
|
1339
1339
|
|
|
@@ -1358,16 +1358,16 @@ separator inserted between each item.
|
|
|
1358
1358
|
|
|
1359
1359
|
Parameters:
|
|
1360
1360
|
|
|
1361
|
-
|param|type|description|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1361
|
+
| param | type | description |
|
|
1362
|
+
| ----------- | -------------- | ---------------------------------------- |
|
|
1363
|
+
| `separator` | `String` | The separator to insert between elements |
|
|
1364
|
+
| `list` | `List<String>` | The list to combine |
|
|
1365
1365
|
|
|
1366
1366
|
Returns:
|
|
1367
1367
|
|
|
1368
|
-
|type|description|
|
|
1369
|
-
|
|
1370
|
-
|
|
1368
|
+
| type | description |
|
|
1369
|
+
| -------- | ----------------------------------------------------- |
|
|
1370
|
+
| `String` | The combined elements with the separator between each |
|
|
1371
1371
|
|
|
1372
1372
|
### List.**revAppend**
|
|
1373
1373
|
|
|
@@ -1384,16 +1384,16 @@ Reverses the first list and appends the second list to the end.
|
|
|
1384
1384
|
|
|
1385
1385
|
Parameters:
|
|
1386
1386
|
|
|
1387
|
-
|param|type|description|
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1387
|
+
| param | type | description |
|
|
1388
|
+
| ------- | --------- | ------------------- |
|
|
1389
|
+
| `list1` | `List<a>` | The list to reverse |
|
|
1390
|
+
| `list2` | `List<a>` | The list to append |
|
|
1391
1391
|
|
|
1392
1392
|
Returns:
|
|
1393
1393
|
|
|
1394
|
-
|type|description|
|
|
1395
|
-
|
|
1396
|
-
|
|
1394
|
+
| type | description |
|
|
1395
|
+
| --------- | ------------ |
|
|
1396
|
+
| `List<a>` | The new list |
|
|
1397
1397
|
|
|
1398
1398
|
### List.**sort**
|
|
1399
1399
|
|
|
@@ -1419,16 +1419,16 @@ Ordering is calculated using a comparator function which takes two list elements
|
|
|
1419
1419
|
|
|
1420
1420
|
Parameters:
|
|
1421
1421
|
|
|
1422
|
-
|param|type|description|
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1422
|
+
| param | type | description |
|
|
1423
|
+
| ---------- | ------------------------------ | --------------------------------------------------- |
|
|
1424
|
+
| `?compare` | `(num1: a, num2: a) => Number` | The comparator function used to indicate sort order |
|
|
1425
|
+
| `list` | `List<a>` | The list to be sorted |
|
|
1426
1426
|
|
|
1427
1427
|
Returns:
|
|
1428
1428
|
|
|
1429
|
-
|type|description|
|
|
1430
|
-
|
|
1431
|
-
|
|
1429
|
+
| type | description |
|
|
1430
|
+
| --------- | --------------- |
|
|
1431
|
+
| `List<a>` | The sorted list |
|
|
1432
1432
|
|
|
1433
1433
|
## List.Associative
|
|
1434
1434
|
|
|
@@ -1466,16 +1466,16 @@ Checks if the given key is present in the list of key-value pairs.
|
|
|
1466
1466
|
|
|
1467
1467
|
Parameters:
|
|
1468
1468
|
|
|
1469
|
-
|param|type|description|
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1469
|
+
| param | type | description |
|
|
1470
|
+
| ------ | -------------- | --------------------------- |
|
|
1471
|
+
| `key` | `a` | The key to search for |
|
|
1472
|
+
| `list` | `List<(a, b)>` | The list of key-value pairs |
|
|
1473
1473
|
|
|
1474
1474
|
Returns:
|
|
1475
1475
|
|
|
1476
|
-
|type|description|
|
|
1477
|
-
|
|
1478
|
-
|
|
1476
|
+
| type | description |
|
|
1477
|
+
| ------ | ----------------------------------------------- |
|
|
1478
|
+
| `Bool` | `true` if the key is found or `false` otherwise |
|
|
1479
1479
|
|
|
1480
1480
|
Examples:
|
|
1481
1481
|
|
|
@@ -1506,16 +1506,16 @@ Retrieves the first value in the list of key-value pairs that matches the given
|
|
|
1506
1506
|
|
|
1507
1507
|
Parameters:
|
|
1508
1508
|
|
|
1509
|
-
|param|type|description|
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1509
|
+
| param | type | description |
|
|
1510
|
+
| ------ | -------------- | --------------------------- |
|
|
1511
|
+
| `key` | `a` | The key to search for |
|
|
1512
|
+
| `list` | `List<(a, b)>` | The list of key-value pairs |
|
|
1513
1513
|
|
|
1514
1514
|
Returns:
|
|
1515
1515
|
|
|
1516
|
-
|type|description|
|
|
1517
|
-
|
|
1518
|
-
|
|
1516
|
+
| type | description |
|
|
1517
|
+
| ----------- | ----------------------------------------------------- |
|
|
1518
|
+
| `Option<b>` | `Some(value)` if the key is found or `None` otherwise |
|
|
1519
1519
|
|
|
1520
1520
|
Examples:
|
|
1521
1521
|
|
|
@@ -1547,16 +1547,16 @@ Retrieves all values in the list of key-value pairs that match the given key.
|
|
|
1547
1547
|
|
|
1548
1548
|
Parameters:
|
|
1549
1549
|
|
|
1550
|
-
|param|type|description|
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1550
|
+
| param | type | description |
|
|
1551
|
+
| ------ | -------------- | --------------------------- |
|
|
1552
|
+
| `key` | `a` | The key to search for |
|
|
1553
|
+
| `list` | `List<(a, b)>` | The list of key-value pairs |
|
|
1554
1554
|
|
|
1555
1555
|
Returns:
|
|
1556
1556
|
|
|
1557
|
-
|type|description|
|
|
1558
|
-
|
|
1559
|
-
|
|
1557
|
+
| type | description |
|
|
1558
|
+
| --------- | ----------------------------------------- |
|
|
1559
|
+
| `List<b>` | An array of values matching the given key |
|
|
1560
1560
|
|
|
1561
1561
|
Examples:
|
|
1562
1562
|
|
|
@@ -1592,17 +1592,17 @@ If the key is not found the item is appended to the list.
|
|
|
1592
1592
|
|
|
1593
1593
|
Parameters:
|
|
1594
1594
|
|
|
1595
|
-
|param|type|description|
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1595
|
+
| param | type | description |
|
|
1596
|
+
| ------- | -------------- | --------------------------- |
|
|
1597
|
+
| `key` | `a` | The key to replace |
|
|
1598
|
+
| `value` | `b` | The new value to set |
|
|
1599
|
+
| `list` | `List<(a, b)>` | The list of key-value pairs |
|
|
1600
1600
|
|
|
1601
1601
|
Returns:
|
|
1602
1602
|
|
|
1603
|
-
|type|description|
|
|
1604
|
-
|
|
1605
|
-
|
|
1603
|
+
| type | description |
|
|
1604
|
+
| -------------- | ------------------------------------------- |
|
|
1605
|
+
| `List<(a, b)>` | A new list with the key-value pair replaced |
|
|
1606
1606
|
|
|
1607
1607
|
Examples:
|
|
1608
1608
|
|
|
@@ -1635,17 +1635,17 @@ If the key is not found the item is appended to the list.
|
|
|
1635
1635
|
|
|
1636
1636
|
Parameters:
|
|
1637
1637
|
|
|
1638
|
-
|param|type|description|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1638
|
+
| param | type | description |
|
|
1639
|
+
| ------- | -------------- | --------------------------- |
|
|
1640
|
+
| `key` | `a` | The key to replace |
|
|
1641
|
+
| `value` | `b` | The new value to set |
|
|
1642
|
+
| `list` | `List<(a, b)>` | The list of key-value pairs |
|
|
1643
1643
|
|
|
1644
1644
|
Returns:
|
|
1645
1645
|
|
|
1646
|
-
|type|description|
|
|
1647
|
-
|
|
1648
|
-
|
|
1646
|
+
| type | description |
|
|
1647
|
+
| -------------- | -------------------------------------------- |
|
|
1648
|
+
| `List<(a, b)>` | A new list with the key-value pairs replaced |
|
|
1649
1649
|
|
|
1650
1650
|
Examples:
|
|
1651
1651
|
|
|
@@ -1678,16 +1678,16 @@ If the key is not found, the list is returned unchanged.
|
|
|
1678
1678
|
|
|
1679
1679
|
Parameters:
|
|
1680
1680
|
|
|
1681
|
-
|param|type|description|
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1681
|
+
| param | type | description |
|
|
1682
|
+
| ------ | -------------- | --------------------------- |
|
|
1683
|
+
| `key` | `a` | The key to remove |
|
|
1684
|
+
| `list` | `List<(a, b)>` | The list of key-value pairs |
|
|
1685
1685
|
|
|
1686
1686
|
Returns:
|
|
1687
1687
|
|
|
1688
|
-
|type|description|
|
|
1689
|
-
|
|
1690
|
-
|
|
1688
|
+
| type | description |
|
|
1689
|
+
| -------------- | -------------------------------------------- |
|
|
1690
|
+
| `List<(a, b)>` | The new list with the key-value pair removed |
|
|
1691
1691
|
|
|
1692
1692
|
Examples:
|
|
1693
1693
|
|
|
@@ -1720,16 +1720,16 @@ If the key is not found, the list is returned unchanged.
|
|
|
1720
1720
|
|
|
1721
1721
|
Parameters:
|
|
1722
1722
|
|
|
1723
|
-
|param|type|description|
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1723
|
+
| param | type | description |
|
|
1724
|
+
| ------ | -------------- | --------------------------- |
|
|
1725
|
+
| `key` | `a` | The key to remove |
|
|
1726
|
+
| `list` | `List<(a, b)>` | The list of key-value pairs |
|
|
1727
1727
|
|
|
1728
1728
|
Returns:
|
|
1729
1729
|
|
|
1730
|
-
|type|description|
|
|
1731
|
-
|
|
1732
|
-
|
|
1730
|
+
| type | description |
|
|
1731
|
+
| -------------- | --------------------------------------------- |
|
|
1732
|
+
| `List<(a, b)>` | The new list with the key-value pairs removed |
|
|
1733
1733
|
|
|
1734
1734
|
Examples:
|
|
1735
1735
|
|