@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/array.md
CHANGED
|
@@ -46,15 +46,15 @@ Provides the length of the input array.
|
|
|
46
46
|
|
|
47
47
|
Parameters:
|
|
48
48
|
|
|
49
|
-
|param|type|description|
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
| param | type | description |
|
|
50
|
+
| ------- | ---------- | -------------------- |
|
|
51
|
+
| `array` | `Array<a>` | The array to inspect |
|
|
52
52
|
|
|
53
53
|
Returns:
|
|
54
54
|
|
|
55
|
-
|type|description|
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
| type | description |
|
|
56
|
+
| -------- | ----------------------------------- |
|
|
57
|
+
| `Number` | The number of elements in the array |
|
|
58
58
|
|
|
59
59
|
Examples:
|
|
60
60
|
|
|
@@ -78,16 +78,16 @@ initialized with the given value.
|
|
|
78
78
|
|
|
79
79
|
Parameters:
|
|
80
80
|
|
|
81
|
-
|param|type|description|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
| param | type | description |
|
|
82
|
+
| -------- | -------- | -------------------------------- |
|
|
83
|
+
| `length` | `Number` | The length of the new array |
|
|
84
|
+
| `item` | `a` | The value to store at each index |
|
|
85
85
|
|
|
86
86
|
Returns:
|
|
87
87
|
|
|
88
|
-
|type|description|
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
| type | description |
|
|
89
|
+
| ---------- | ------------- |
|
|
90
|
+
| `Array<a>` | The new array |
|
|
91
91
|
|
|
92
92
|
Throws:
|
|
93
93
|
|
|
@@ -119,16 +119,16 @@ is called with the index of each array element.
|
|
|
119
119
|
|
|
120
120
|
Parameters:
|
|
121
121
|
|
|
122
|
-
|param|type|description|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
| param | type | description |
|
|
123
|
+
| -------- | ------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
124
|
+
| `length` | `Number` | The length of the new array |
|
|
125
|
+
| `fn` | `Number => a` | The initializer function to call with each index, where the value returned will be used to initialize the element |
|
|
126
126
|
|
|
127
127
|
Returns:
|
|
128
128
|
|
|
129
|
-
|type|description|
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
| type | description |
|
|
130
|
+
| ---------- | ------------- |
|
|
131
|
+
| `Array<a>` | The new array |
|
|
132
132
|
|
|
133
133
|
Throws:
|
|
134
134
|
|
|
@@ -162,16 +162,16 @@ initializer succeed or the first error otherwise.
|
|
|
162
162
|
|
|
163
163
|
Parameters:
|
|
164
164
|
|
|
165
|
-
|param|type|description|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
| param | type | description |
|
|
166
|
+
| -------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
167
|
+
| `length` | `Number` | The length of the new array |
|
|
168
|
+
| `fn` | `Number => Result<a, b>` | The initializer function to call with each index, where the `Ok` value returned will be used to initialize each element |
|
|
169
169
|
|
|
170
170
|
Returns:
|
|
171
171
|
|
|
172
|
-
|type|description|
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
| type | description |
|
|
173
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| `Result<Array<a>, b>` | `Ok(array)` if all elements were successfully initialized or `Err(error)` if the initializer function returned an error |
|
|
175
175
|
|
|
176
176
|
Throws:
|
|
177
177
|
|
|
@@ -215,16 +215,16 @@ A negative index is treated as an offset from the end of the array.
|
|
|
215
215
|
|
|
216
216
|
Parameters:
|
|
217
217
|
|
|
218
|
-
|param|type|description|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
| param | type | description |
|
|
219
|
+
| ------- | ---------- | ------------------- |
|
|
220
|
+
| `index` | `Number` | The index to access |
|
|
221
|
+
| `array` | `Array<a>` | The array to access |
|
|
222
222
|
|
|
223
223
|
Returns:
|
|
224
224
|
|
|
225
|
-
|type|description|
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
| type | description |
|
|
226
|
+
| ---- | -------------------------- |
|
|
227
|
+
| `a` | The element from the array |
|
|
228
228
|
|
|
229
229
|
Throws:
|
|
230
230
|
|
|
@@ -264,11 +264,11 @@ A negative index is treated as an offset from the end of the array.
|
|
|
264
264
|
|
|
265
265
|
Parameters:
|
|
266
266
|
|
|
267
|
-
|param|type|description|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
| param | type | description |
|
|
268
|
+
| ------- | ---------- | ------------------- |
|
|
269
|
+
| `index` | `Number` | The index to update |
|
|
270
|
+
| `value` | `a` | The value to store |
|
|
271
|
+
| `array` | `Array<a>` | The array to update |
|
|
272
272
|
|
|
273
273
|
Throws:
|
|
274
274
|
|
|
@@ -301,16 +301,16 @@ the elements of the second array. This does not modify the arguments.
|
|
|
301
301
|
|
|
302
302
|
Parameters:
|
|
303
303
|
|
|
304
|
-
|param|type|description|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
| param | type | description |
|
|
305
|
+
| -------- | ---------- | ---------------------------------------------- |
|
|
306
|
+
| `array1` | `Array<a>` | The array containing elements to appear first |
|
|
307
|
+
| `array2` | `Array<a>` | The array containing elements to appear second |
|
|
308
308
|
|
|
309
309
|
Returns:
|
|
310
310
|
|
|
311
|
-
|type|description|
|
|
312
|
-
|
|
313
|
-
|
|
311
|
+
| type | description |
|
|
312
|
+
| ---------- | ---------------------------------------------------------------------------------- |
|
|
313
|
+
| `Array<a>` | The new array containing elements from `array1` followed by elements from `array2` |
|
|
314
314
|
|
|
315
315
|
Throws:
|
|
316
316
|
|
|
@@ -340,15 +340,15 @@ provided list. Does not modify any of the input arguments.
|
|
|
340
340
|
|
|
341
341
|
Parameters:
|
|
342
342
|
|
|
343
|
-
|param|type|description|
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
| param | type | description |
|
|
344
|
+
| -------- | ---------------- | --------------------------------------- |
|
|
345
|
+
| `arrays` | `List<Array<a>>` | A list containing all arrays to combine |
|
|
346
346
|
|
|
347
347
|
Returns:
|
|
348
348
|
|
|
349
|
-
|type|description|
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
| type | description |
|
|
350
|
+
| ---------- | ------------- |
|
|
351
|
+
| `Array<a>` | The new array |
|
|
352
352
|
|
|
353
353
|
Throws:
|
|
354
354
|
|
|
@@ -378,15 +378,15 @@ same elements as the original.
|
|
|
378
378
|
|
|
379
379
|
Parameters:
|
|
380
380
|
|
|
381
|
-
|param|type|description|
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
| param | type | description |
|
|
382
|
+
| ------- | ---------- | ----------------- |
|
|
383
|
+
| `array` | `Array<a>` | The array to copy |
|
|
384
384
|
|
|
385
385
|
Returns:
|
|
386
386
|
|
|
387
|
-
|type|description|
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
| type | description |
|
|
388
|
+
| ---------- | ---------------------------------------------------- |
|
|
389
|
+
| `Array<a>` | The new array containing the elements from the input |
|
|
390
390
|
|
|
391
391
|
Examples:
|
|
392
392
|
|
|
@@ -409,11 +409,11 @@ Iterates an array a given number of times, calling an iterator function on each
|
|
|
409
409
|
|
|
410
410
|
Parameters:
|
|
411
411
|
|
|
412
|
-
|param|type|description|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
412
|
+
| param | type | description |
|
|
413
|
+
| ------- | ----------- | ----------------------------------------------- |
|
|
414
|
+
| `fn` | `a => Void` | The iterator function to call with each element |
|
|
415
|
+
| `n` | `Number` | The number of times to iterate the given array |
|
|
416
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
417
417
|
|
|
418
418
|
Examples:
|
|
419
419
|
|
|
@@ -445,10 +445,10 @@ Iterates an array, calling an iterator function on each element.
|
|
|
445
445
|
|
|
446
446
|
Parameters:
|
|
447
447
|
|
|
448
|
-
|param|type|description|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
| param | type | description |
|
|
449
|
+
| ------- | ----------- | ----------------------------------------------- |
|
|
450
|
+
| `fn` | `a => Void` | The iterator function to call with each element |
|
|
451
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
452
452
|
|
|
453
453
|
Examples:
|
|
454
454
|
|
|
@@ -481,10 +481,10 @@ Also passes the index as the second argument to the function.
|
|
|
481
481
|
|
|
482
482
|
Parameters:
|
|
483
483
|
|
|
484
|
-
|param|type|description|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
484
|
+
| param | type | description |
|
|
485
|
+
| ------- | --------------------- | ----------------------------------------------- |
|
|
486
|
+
| `fn` | `(a, Number) => Void` | The iterator function to call with each element |
|
|
487
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
488
488
|
|
|
489
489
|
Examples:
|
|
490
490
|
|
|
@@ -517,16 +517,16 @@ called on each element of the input array.
|
|
|
517
517
|
|
|
518
518
|
Parameters:
|
|
519
519
|
|
|
520
|
-
|param|type|description|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
520
|
+
| param | type | description |
|
|
521
|
+
| ------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
522
|
+
| `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 array |
|
|
523
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
524
524
|
|
|
525
525
|
Returns:
|
|
526
526
|
|
|
527
|
-
|type|description|
|
|
528
|
-
|
|
529
|
-
|
|
527
|
+
| type | description |
|
|
528
|
+
| ---------- | -------------------------------- |
|
|
529
|
+
| `Array<b>` | The new array with mapped values |
|
|
530
530
|
|
|
531
531
|
Examples:
|
|
532
532
|
|
|
@@ -550,16 +550,16 @@ called on each element of the input array and its index.
|
|
|
550
550
|
|
|
551
551
|
Parameters:
|
|
552
552
|
|
|
553
|
-
|param|type|description|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
553
|
+
| param | type | description |
|
|
554
|
+
| ------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
555
|
+
| `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 array |
|
|
556
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
557
557
|
|
|
558
558
|
Returns:
|
|
559
559
|
|
|
560
|
-
|type|description|
|
|
561
|
-
|
|
562
|
-
|
|
560
|
+
| type | description |
|
|
561
|
+
| ---------- | -------------------------------- |
|
|
562
|
+
| `Array<b>` | The new array with mapped values |
|
|
563
563
|
|
|
564
564
|
Examples:
|
|
565
565
|
|
|
@@ -588,17 +588,17 @@ returned. The accumulator starts with value `initial`.
|
|
|
588
588
|
|
|
589
589
|
Parameters:
|
|
590
590
|
|
|
591
|
-
|param|type|description|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
591
|
+
| param | type | description |
|
|
592
|
+
| --------- | ------------- | --------------------------------------------------------------------------------------------------------- |
|
|
593
|
+
| `fn` | `(a, b) => a` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
594
|
+
| `initial` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
595
|
+
| `array` | `Array<b>` | The array to iterate |
|
|
596
596
|
|
|
597
597
|
Returns:
|
|
598
598
|
|
|
599
|
-
|type|description|
|
|
600
|
-
|
|
601
|
-
|
|
599
|
+
| type | description |
|
|
600
|
+
| ---- | ---------------------------------------- |
|
|
601
|
+
| `a` | The final accumulator returned from `fn` |
|
|
602
602
|
|
|
603
603
|
Examples:
|
|
604
604
|
|
|
@@ -631,17 +631,17 @@ returned. The accumulator starts with value `initial`.
|
|
|
631
631
|
|
|
632
632
|
Parameters:
|
|
633
633
|
|
|
634
|
-
|param|type|description|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
634
|
+
| param | type | description |
|
|
635
|
+
| --------- | ------------- | --------------------------------------------------------------------------------------------------------- |
|
|
636
|
+
| `fn` | `(a, b) => b` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
637
|
+
| `initial` | `b` | The initial value to use for the accumulator on the first iteration |
|
|
638
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
639
639
|
|
|
640
640
|
Returns:
|
|
641
641
|
|
|
642
|
-
|type|description|
|
|
643
|
-
|
|
644
|
-
|
|
642
|
+
| type | description |
|
|
643
|
+
| ---- | ---------------------------------------- |
|
|
644
|
+
| `b` | The final accumulator returned from `fn` |
|
|
645
645
|
|
|
646
646
|
Examples:
|
|
647
647
|
|
|
@@ -671,17 +671,17 @@ starts with value `initial`.
|
|
|
671
671
|
|
|
672
672
|
Parameters:
|
|
673
673
|
|
|
674
|
-
|param|type|description|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
674
|
+
| param | type | description |
|
|
675
|
+
| --------- | --------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
676
|
+
| `fn` | `(a, b, Number) => a` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
677
|
+
| `initial` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
678
|
+
| `array` | `Array<b>` | The array to iterate |
|
|
679
679
|
|
|
680
680
|
Returns:
|
|
681
681
|
|
|
682
|
-
|type|description|
|
|
683
|
-
|
|
684
|
-
|
|
682
|
+
| type | description |
|
|
683
|
+
| ---- | ---------------------------------------- |
|
|
684
|
+
| `a` | The final accumulator returned from `fn` |
|
|
685
685
|
|
|
686
686
|
Examples:
|
|
687
687
|
|
|
@@ -714,16 +714,16 @@ of all results.
|
|
|
714
714
|
|
|
715
715
|
Parameters:
|
|
716
716
|
|
|
717
|
-
|param|type|description|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
717
|
+
| param | type | description |
|
|
718
|
+
| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
719
|
+
| `fn` | `b => Array<a>` | The function to be called on each element, where the value returned will be an array that gets appended to the new array |
|
|
720
|
+
| `array` | `Array<b>` | The array to iterate |
|
|
721
721
|
|
|
722
722
|
Returns:
|
|
723
723
|
|
|
724
|
-
|type|description|
|
|
725
|
-
|
|
726
|
-
|
|
724
|
+
| type | description |
|
|
725
|
+
| ---------- | ------------- |
|
|
726
|
+
| `Array<a>` | The new array |
|
|
727
727
|
|
|
728
728
|
Throws:
|
|
729
729
|
|
|
@@ -753,16 +753,16 @@ elements in the input array.
|
|
|
753
753
|
|
|
754
754
|
Parameters:
|
|
755
755
|
|
|
756
|
-
|param|type|description|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
756
|
+
| param | type | description |
|
|
757
|
+
| ------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
758
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
759
|
+
| `array` | `Array<a>` | The array to check |
|
|
760
760
|
|
|
761
761
|
Returns:
|
|
762
762
|
|
|
763
|
-
|type|description|
|
|
764
|
-
|
|
765
|
-
|
|
763
|
+
| type | description |
|
|
764
|
+
| ------ | ----------------------------------------------------------------- |
|
|
765
|
+
| `Bool` | `true` if all elements satisfy the condition or `false` otherwise |
|
|
766
766
|
|
|
767
767
|
Examples:
|
|
768
768
|
|
|
@@ -790,16 +790,16 @@ once** by an element in the input array.
|
|
|
790
790
|
|
|
791
791
|
Parameters:
|
|
792
792
|
|
|
793
|
-
|param|type|description|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
793
|
+
| param | type | description |
|
|
794
|
+
| ------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
795
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
796
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
797
797
|
|
|
798
798
|
Returns:
|
|
799
799
|
|
|
800
|
-
|type|description|
|
|
801
|
-
|
|
802
|
-
|
|
800
|
+
| type | description |
|
|
801
|
+
| ------ | ------------------------------------------------------------------------- |
|
|
802
|
+
| `Bool` | `true` if one or more elements satisfy the condition or `false` otherwise |
|
|
803
803
|
|
|
804
804
|
Examples:
|
|
805
805
|
|
|
@@ -830,10 +830,10 @@ Replaces all elements in an array with the new value provided.
|
|
|
830
830
|
|
|
831
831
|
Parameters:
|
|
832
832
|
|
|
833
|
-
|param|type|description|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
833
|
+
| param | type | description |
|
|
834
|
+
| ------- | ---------- | -------------------------------- |
|
|
835
|
+
| `value` | `a` | The value replacing each element |
|
|
836
|
+
| `array` | `Array<a>` | The array to update |
|
|
837
837
|
|
|
838
838
|
Examples:
|
|
839
839
|
|
|
@@ -859,12 +859,12 @@ with the new value provided. Fails if the index is out-of-bounds.
|
|
|
859
859
|
|
|
860
860
|
Parameters:
|
|
861
861
|
|
|
862
|
-
|param|type|description|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
862
|
+
| param | type | description |
|
|
863
|
+
| ------- | ---------- | ---------------------------------------------------- |
|
|
864
|
+
| `value` | `a` | The value replacing each element between the indexes |
|
|
865
|
+
| `start` | `Number` | The index to begin replacement |
|
|
866
|
+
| `stop` | `Number` | The (exclusive) index to end replacement |
|
|
867
|
+
| `array` | `Array<a>` | The array to update |
|
|
868
868
|
|
|
869
869
|
Throws:
|
|
870
870
|
|
|
@@ -896,15 +896,15 @@ Creates a new array with all elements in reverse order.
|
|
|
896
896
|
|
|
897
897
|
Parameters:
|
|
898
898
|
|
|
899
|
-
|param|type|description|
|
|
900
|
-
|
|
901
|
-
|
|
899
|
+
| param | type | description |
|
|
900
|
+
| ------- | ---------- | -------------------- |
|
|
901
|
+
| `array` | `Array<a>` | The array to reverse |
|
|
902
902
|
|
|
903
903
|
Returns:
|
|
904
904
|
|
|
905
|
-
|type|description|
|
|
906
|
-
|
|
907
|
-
|
|
905
|
+
| type | description |
|
|
906
|
+
| ---------- | ------------- |
|
|
907
|
+
| `Array<a>` | The new array |
|
|
908
908
|
|
|
909
909
|
Examples:
|
|
910
910
|
|
|
@@ -927,15 +927,15 @@ Converts the input array to a list.
|
|
|
927
927
|
|
|
928
928
|
Parameters:
|
|
929
929
|
|
|
930
|
-
|param|type|description|
|
|
931
|
-
|
|
932
|
-
|
|
930
|
+
| param | type | description |
|
|
931
|
+
| ------- | ---------- | -------------------- |
|
|
932
|
+
| `array` | `Array<a>` | The array to convert |
|
|
933
933
|
|
|
934
934
|
Returns:
|
|
935
935
|
|
|
936
|
-
|type|description|
|
|
937
|
-
|
|
938
|
-
|
|
936
|
+
| type | description |
|
|
937
|
+
| --------- | ----------------------------------------------- |
|
|
938
|
+
| `List<a>` | The list containing all elements from the array |
|
|
939
939
|
|
|
940
940
|
Examples:
|
|
941
941
|
|
|
@@ -958,15 +958,15 @@ Converts the input list to an array.
|
|
|
958
958
|
|
|
959
959
|
Parameters:
|
|
960
960
|
|
|
961
|
-
|param|type|description|
|
|
962
|
-
|
|
963
|
-
|
|
961
|
+
| param | type | description |
|
|
962
|
+
| ------ | --------- | ------------------- |
|
|
963
|
+
| `list` | `List<a>` | The list to convert |
|
|
964
964
|
|
|
965
965
|
Returns:
|
|
966
966
|
|
|
967
|
-
|type|description|
|
|
968
|
-
|
|
969
|
-
|
|
967
|
+
| type | description |
|
|
968
|
+
| ---------- | ----------------------------------------------- |
|
|
969
|
+
| `Array<a>` | The array containing all elements from the list |
|
|
970
970
|
|
|
971
971
|
Examples:
|
|
972
972
|
|
|
@@ -990,16 +990,16 @@ Uses the generic `==` structural equality operator.
|
|
|
990
990
|
|
|
991
991
|
Parameters:
|
|
992
992
|
|
|
993
|
-
|param|type|description|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
993
|
+
| param | type | description |
|
|
994
|
+
| -------- | ---------- | -------------------- |
|
|
995
|
+
| `search` | `a` | The value to compare |
|
|
996
|
+
| `array` | `Array<a>` | The array to inspect |
|
|
997
997
|
|
|
998
998
|
Returns:
|
|
999
999
|
|
|
1000
|
-
|type|description|
|
|
1001
|
-
|
|
1002
|
-
|
|
1000
|
+
| type | description |
|
|
1001
|
+
| ------ | ------------------------------------------------------------ |
|
|
1002
|
+
| `Bool` | `true` if the value exists in the array or `false` otherwise |
|
|
1003
1003
|
|
|
1004
1004
|
Examples:
|
|
1005
1005
|
|
|
@@ -1026,16 +1026,16 @@ Finds the first element in an array that satisfies the given condition.
|
|
|
1026
1026
|
|
|
1027
1027
|
Parameters:
|
|
1028
1028
|
|
|
1029
|
-
|param|type|description|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1029
|
+
| param | type | description |
|
|
1030
|
+
| ------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1031
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1032
|
+
| `array` | `Array<a>` | The array to search |
|
|
1033
1033
|
|
|
1034
1034
|
Returns:
|
|
1035
1035
|
|
|
1036
|
-
|type|description|
|
|
1037
|
-
|
|
1038
|
-
|
|
1036
|
+
| type | description |
|
|
1037
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
1038
|
+
| `Option<a>` | `Some(element)` containing the first value found or `None` otherwise |
|
|
1039
1039
|
|
|
1040
1040
|
Examples:
|
|
1041
1041
|
|
|
@@ -1066,16 +1066,16 @@ Finds the first index in an array where the element satisfies the given conditio
|
|
|
1066
1066
|
|
|
1067
1067
|
Parameters:
|
|
1068
1068
|
|
|
1069
|
-
|param|type|description|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1069
|
+
| param | type | description |
|
|
1070
|
+
| ------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1071
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1072
|
+
| `array` | `Array<a>` | The array to search |
|
|
1073
1073
|
|
|
1074
1074
|
Returns:
|
|
1075
1075
|
|
|
1076
|
-
|type|description|
|
|
1077
|
-
|
|
1078
|
-
|
|
1076
|
+
| type | description |
|
|
1077
|
+
| ---------------- | --------------------------------------------------------------------------------- |
|
|
1078
|
+
| `Option<Number>` | `Some(index)` containing the index of the first element found or `None` otherwise |
|
|
1079
1079
|
|
|
1080
1080
|
Examples:
|
|
1081
1081
|
|
|
@@ -1107,16 +1107,16 @@ all ordered pairs `(a, b)`.
|
|
|
1107
1107
|
|
|
1108
1108
|
Parameters:
|
|
1109
1109
|
|
|
1110
|
-
|param|type|description|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1110
|
+
| param | type | description |
|
|
1111
|
+
| -------- | ---------- | -------------------------------------------------------- |
|
|
1112
|
+
| `array1` | `Array<a>` | The array to provide values for the first tuple element |
|
|
1113
|
+
| `array2` | `Array<b>` | The array to provide values for the second tuple element |
|
|
1114
1114
|
|
|
1115
1115
|
Returns:
|
|
1116
1116
|
|
|
1117
|
-
|type|description|
|
|
1118
|
-
|
|
1119
|
-
|
|
1117
|
+
| type | description |
|
|
1118
|
+
| --------------- | ---------------------------------------------- |
|
|
1119
|
+
| `Array<(a, b)>` | The new array containing all pairs of `(a, b)` |
|
|
1120
1120
|
|
|
1121
1121
|
Throws:
|
|
1122
1122
|
|
|
@@ -1145,16 +1145,16 @@ Counts the number of elements in an array that satisfy the given condition.
|
|
|
1145
1145
|
|
|
1146
1146
|
Parameters:
|
|
1147
1147
|
|
|
1148
|
-
|param|type|description|
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1148
|
+
| param | type | description |
|
|
1149
|
+
| ------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1150
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1151
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
1152
1152
|
|
|
1153
1153
|
Returns:
|
|
1154
1154
|
|
|
1155
|
-
|type|description|
|
|
1156
|
-
|
|
1157
|
-
|
|
1155
|
+
| type | description |
|
|
1156
|
+
| -------- | ------------------------------------------------------- |
|
|
1157
|
+
| `Number` | The total number of elements that satisfy the condition |
|
|
1158
1158
|
|
|
1159
1159
|
Examples:
|
|
1160
1160
|
|
|
@@ -1178,16 +1178,16 @@ given condition. Also passes the index to the function.
|
|
|
1178
1178
|
|
|
1179
1179
|
Parameters:
|
|
1180
1180
|
|
|
1181
|
-
|param|type|description|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1181
|
+
| param | type | description |
|
|
1182
|
+
| ------- | --------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1183
|
+
| `fn` | `(a, Number) => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1184
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
1185
1185
|
|
|
1186
1186
|
Returns:
|
|
1187
1187
|
|
|
1188
|
-
|type|description|
|
|
1189
|
-
|
|
1190
|
-
|
|
1188
|
+
| type | description |
|
|
1189
|
+
| -------- | ------------------------------------------------------- |
|
|
1190
|
+
| `Number` | The total number of elements that satisfy the condition |
|
|
1191
1191
|
|
|
1192
1192
|
Examples:
|
|
1193
1193
|
|
|
@@ -1216,16 +1216,16 @@ the condition.
|
|
|
1216
1216
|
|
|
1217
1217
|
Parameters:
|
|
1218
1218
|
|
|
1219
|
-
|param|type|description|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1219
|
+
| param | type | description |
|
|
1220
|
+
| ------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1221
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1222
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
1223
1223
|
|
|
1224
1224
|
Returns:
|
|
1225
1225
|
|
|
1226
|
-
|type|description|
|
|
1227
|
-
|
|
1228
|
-
|
|
1226
|
+
| type | description |
|
|
1227
|
+
| ---------- | ------------------------------------------------------------ |
|
|
1228
|
+
| `Array<a>` | The new array containing elements where `fn` returned `true` |
|
|
1229
1229
|
|
|
1230
1230
|
Examples:
|
|
1231
1231
|
|
|
@@ -1250,16 +1250,16 @@ the condition. Also passes the index to the function.
|
|
|
1250
1250
|
|
|
1251
1251
|
Parameters:
|
|
1252
1252
|
|
|
1253
|
-
|param|type|description|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1253
|
+
| param | type | description |
|
|
1254
|
+
| ------- | --------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1255
|
+
| `fn` | `(a, Number) => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
1256
|
+
| `array` | `Array<a>` | The array to iterate |
|
|
1257
1257
|
|
|
1258
1258
|
Returns:
|
|
1259
1259
|
|
|
1260
|
-
|type|description|
|
|
1261
|
-
|
|
1262
|
-
|
|
1260
|
+
| type | description |
|
|
1261
|
+
| ---------- | ------------------------------------------------------------ |
|
|
1262
|
+
| `Array<a>` | The new array containing elements where `fn` returned `true` |
|
|
1263
1263
|
|
|
1264
1264
|
Examples:
|
|
1265
1265
|
|
|
@@ -1287,15 +1287,15 @@ Uses the generic `==` structural equality operator.
|
|
|
1287
1287
|
|
|
1288
1288
|
Parameters:
|
|
1289
1289
|
|
|
1290
|
-
|param|type|description|
|
|
1291
|
-
|
|
1292
|
-
|
|
1290
|
+
| param | type | description |
|
|
1291
|
+
| ------- | ---------- | ------------------- |
|
|
1292
|
+
| `array` | `Array<a>` | The array to filter |
|
|
1293
1293
|
|
|
1294
1294
|
Returns:
|
|
1295
1295
|
|
|
1296
|
-
|type|description|
|
|
1297
|
-
|
|
1298
|
-
|
|
1296
|
+
| type | description |
|
|
1297
|
+
| ---------- | ------------------------------------- |
|
|
1298
|
+
| `Array<a>` | The new array with only unique values |
|
|
1299
1299
|
|
|
1300
1300
|
Examples:
|
|
1301
1301
|
|
|
@@ -1327,16 +1327,16 @@ will contain the second item of each array, and so on.
|
|
|
1327
1327
|
|
|
1328
1328
|
Parameters:
|
|
1329
1329
|
|
|
1330
|
-
|param|type|description|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1330
|
+
| param | type | description |
|
|
1331
|
+
| -------- | ---------- | -------------------------------------------------------- |
|
|
1332
|
+
| `array1` | `Array<a>` | The array to provide values for the first tuple element |
|
|
1333
|
+
| `array2` | `Array<b>` | The array to provide values for the second tuple element |
|
|
1334
1334
|
|
|
1335
1335
|
Returns:
|
|
1336
1336
|
|
|
1337
|
-
|type|description|
|
|
1338
|
-
|
|
1339
|
-
|
|
1337
|
+
| type | description |
|
|
1338
|
+
| --------------- | -------------------------------------------------- |
|
|
1339
|
+
| `Array<(a, b)>` | The new array containing indexed pairs of `(a, b)` |
|
|
1340
1340
|
|
|
1341
1341
|
Throws:
|
|
1342
1342
|
|
|
@@ -1372,17 +1372,17 @@ array to have the length of the smaller array.
|
|
|
1372
1372
|
|
|
1373
1373
|
Parameters:
|
|
1374
1374
|
|
|
1375
|
-
|param|type|description|
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1375
|
+
| param | type | description |
|
|
1376
|
+
| -------- | ------------- | ----------------------------------------------------------------------------------- |
|
|
1377
|
+
| `fn` | `(a, b) => c` | The function to apply to pairs of elements |
|
|
1378
|
+
| `array1` | `Array<a>` | The array whose elements will each be passed to the function as the first argument |
|
|
1379
|
+
| `array2` | `Array<b>` | The array whose elements will each be passed to the function as the second argument |
|
|
1380
1380
|
|
|
1381
1381
|
Returns:
|
|
1382
1382
|
|
|
1383
|
-
|type|description|
|
|
1384
|
-
|
|
1385
|
-
|
|
1383
|
+
| type | description |
|
|
1384
|
+
| ---------- | ----------------------------------------------------------------------------------------------------- |
|
|
1385
|
+
| `Array<c>` | The new array containing elements derived from applying the function to pairs of input array elements |
|
|
1386
1386
|
|
|
1387
1387
|
Throws:
|
|
1388
1388
|
|
|
@@ -1415,15 +1415,15 @@ Produces two arrays by splitting apart an array of tuples.
|
|
|
1415
1415
|
|
|
1416
1416
|
Parameters:
|
|
1417
1417
|
|
|
1418
|
-
|param|type|description|
|
|
1419
|
-
|
|
1420
|
-
|
|
1418
|
+
| param | type | description |
|
|
1419
|
+
| ------- | --------------- | ---------------------------- |
|
|
1420
|
+
| `array` | `Array<(a, b)>` | The array of tuples to split |
|
|
1421
1421
|
|
|
1422
1422
|
Returns:
|
|
1423
1423
|
|
|
1424
|
-
|type|description|
|
|
1425
|
-
|
|
1426
|
-
|
|
1424
|
+
| type | description |
|
|
1425
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
1426
|
+
| `(Array<a>, Array<b>)` | An array containing all elements from the first tuple element, and an array containing all elements from the second tuple element |
|
|
1427
1427
|
|
|
1428
1428
|
Examples:
|
|
1429
1429
|
|
|
@@ -1446,16 +1446,16 @@ Concatenates an array of strings into a single string, separated by a separator
|
|
|
1446
1446
|
|
|
1447
1447
|
Parameters:
|
|
1448
1448
|
|
|
1449
|
-
|param|type|description|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1449
|
+
| param | type | description |
|
|
1450
|
+
| ----------- | --------------- | --------------------------------------------------- |
|
|
1451
|
+
| `separator` | `String` | The separator to insert between items in the string |
|
|
1452
|
+
| `items` | `Array<String>` | The input strings |
|
|
1453
1453
|
|
|
1454
1454
|
Returns:
|
|
1455
1455
|
|
|
1456
|
-
|type|description|
|
|
1457
|
-
|
|
1458
|
-
|
|
1456
|
+
| type | description |
|
|
1457
|
+
| -------- | ----------------------- |
|
|
1458
|
+
| `String` | The concatenated string |
|
|
1459
1459
|
|
|
1460
1460
|
Examples:
|
|
1461
1461
|
|
|
@@ -1489,17 +1489,17 @@ the end of the array. e.g. `slice(1, -1, [> 'a', 'b', 'c']) == [> 'b']`.
|
|
|
1489
1489
|
|
|
1490
1490
|
Parameters:
|
|
1491
1491
|
|
|
1492
|
-
|param|type|description|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1492
|
+
| param | type | description |
|
|
1493
|
+
| ------- | ---------- | ------------------------------------------------------------- |
|
|
1494
|
+
| `start` | `Number` | The index of the array where the slice will begin (inclusive) |
|
|
1495
|
+
| `?end` | `Number` | The index of the array where the slice will end (exclusive) |
|
|
1496
|
+
| `array` | `Array<a>` | The array to be sliced |
|
|
1497
1497
|
|
|
1498
1498
|
Returns:
|
|
1499
1499
|
|
|
1500
|
-
|type|description|
|
|
1501
|
-
|
|
1502
|
-
|
|
1500
|
+
| type | description |
|
|
1501
|
+
| ---------- | --------------------------------------- |
|
|
1502
|
+
| `Array<a>` | The subset of the array that was sliced |
|
|
1503
1503
|
|
|
1504
1504
|
Examples:
|
|
1505
1505
|
|
|
@@ -1535,10 +1535,10 @@ Ordering is calculated using a comparator function which takes two array element
|
|
|
1535
1535
|
|
|
1536
1536
|
Parameters:
|
|
1537
1537
|
|
|
1538
|
-
|param|type|description|
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1538
|
+
| param | type | description |
|
|
1539
|
+
| ---------- | ------------------------------ | --------------------------------------------------- |
|
|
1540
|
+
| `?compare` | `(num1: a, num2: a) => Number` | The comparator function used to indicate sort order |
|
|
1541
|
+
| `array` | `Array<a>` | The array to be sorted |
|
|
1542
1542
|
|
|
1543
1543
|
Examples:
|
|
1544
1544
|
|
|
@@ -1574,10 +1574,10 @@ specified amount to the right. See examples.
|
|
|
1574
1574
|
|
|
1575
1575
|
Parameters:
|
|
1576
1576
|
|
|
1577
|
-
|param|type|description|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1577
|
+
| param | type | description |
|
|
1578
|
+
| ----- | ---------- | ----------------------------------- |
|
|
1579
|
+
| `n` | `Number` | The number of elements to rotate by |
|
|
1580
|
+
| `arr` | `Array<a>` | The array to be rotated |
|
|
1581
1581
|
|
|
1582
1582
|
Examples:
|
|
1583
1583
|
|
|
@@ -1609,16 +1609,16 @@ If the array cannot be split evenly, the final chunk will contain the remaining
|
|
|
1609
1609
|
|
|
1610
1610
|
Parameters:
|
|
1611
1611
|
|
|
1612
|
-
|param|type|description|
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1612
|
+
| param | type | description |
|
|
1613
|
+
| ----------- | ---------- | ------------------------------ |
|
|
1614
|
+
| `chunkSize` | `Number` | The maximum size of each chunk |
|
|
1615
|
+
| `arr` | `Array<a>` | The array to chunk |
|
|
1616
1616
|
|
|
1617
1617
|
Returns:
|
|
1618
1618
|
|
|
1619
|
-
|type|description|
|
|
1620
|
-
|
|
1621
|
-
|
|
1619
|
+
| type | description |
|
|
1620
|
+
| ----------------- | ------------------ |
|
|
1621
|
+
| `Array<Array<a>>` | An array of chunks |
|
|
1622
1622
|
|
|
1623
1623
|
Throws:
|
|
1624
1624
|
|
|
@@ -1727,15 +1727,15 @@ Determines if the array contains no elements.
|
|
|
1727
1727
|
|
|
1728
1728
|
Parameters:
|
|
1729
1729
|
|
|
1730
|
-
|param|type|description|
|
|
1731
|
-
|
|
1732
|
-
|
|
1730
|
+
| param | type | description |
|
|
1731
|
+
| ------- | ------------------- | ------------------ |
|
|
1732
|
+
| `array` | `ImmutableArray<a>` | The array to check |
|
|
1733
1733
|
|
|
1734
1734
|
Returns:
|
|
1735
1735
|
|
|
1736
|
-
|type|description|
|
|
1737
|
-
|
|
1738
|
-
|
|
1736
|
+
| type | description |
|
|
1737
|
+
| ------ | -------------------------------------------------- |
|
|
1738
|
+
| `Bool` | `true` if the array is empty and `false` otherwise |
|
|
1739
1739
|
|
|
1740
1740
|
Examples:
|
|
1741
1741
|
|
|
@@ -1771,15 +1771,15 @@ Provides the length of the input array.
|
|
|
1771
1771
|
|
|
1772
1772
|
Parameters:
|
|
1773
1773
|
|
|
1774
|
-
|param|type|description|
|
|
1775
|
-
|
|
1776
|
-
|
|
1774
|
+
| param | type | description |
|
|
1775
|
+
| ------- | ------------------- | -------------------- |
|
|
1776
|
+
| `array` | `ImmutableArray<a>` | The array to inspect |
|
|
1777
1777
|
|
|
1778
1778
|
Returns:
|
|
1779
1779
|
|
|
1780
|
-
|type|description|
|
|
1781
|
-
|
|
1782
|
-
|
|
1780
|
+
| type | description |
|
|
1781
|
+
| -------- | ----------------------------------- |
|
|
1782
|
+
| `Number` | The number of elements in the array |
|
|
1783
1783
|
|
|
1784
1784
|
Examples:
|
|
1785
1785
|
|
|
@@ -1811,16 +1811,16 @@ A negative index is treated as an offset from the end of the array.
|
|
|
1811
1811
|
|
|
1812
1812
|
Parameters:
|
|
1813
1813
|
|
|
1814
|
-
|param|type|description|
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1814
|
+
| param | type | description |
|
|
1815
|
+
| ------- | ------------------- | ------------------- |
|
|
1816
|
+
| `index` | `Number` | The index to access |
|
|
1817
|
+
| `array` | `ImmutableArray<a>` | The array to access |
|
|
1818
1818
|
|
|
1819
1819
|
Returns:
|
|
1820
1820
|
|
|
1821
|
-
|type|description|
|
|
1822
|
-
|
|
1823
|
-
|
|
1821
|
+
| type | description |
|
|
1822
|
+
| ---- | -------------------------- |
|
|
1823
|
+
| `a` | The element from the array |
|
|
1824
1824
|
|
|
1825
1825
|
Throws:
|
|
1826
1826
|
|
|
@@ -1863,17 +1863,17 @@ new value. A negative index is treated as an offset from the end of the array.
|
|
|
1863
1863
|
|
|
1864
1864
|
Parameters:
|
|
1865
1865
|
|
|
1866
|
-
|param|type|description|
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1866
|
+
| param | type | description |
|
|
1867
|
+
| ------- | ------------------- | ------------------- |
|
|
1868
|
+
| `index` | `Number` | The index to update |
|
|
1869
|
+
| `value` | `a` | The value to store |
|
|
1870
|
+
| `array` | `ImmutableArray<a>` | The array to update |
|
|
1871
1871
|
|
|
1872
1872
|
Returns:
|
|
1873
1873
|
|
|
1874
|
-
|type|description|
|
|
1875
|
-
|
|
1876
|
-
|
|
1874
|
+
| type | description |
|
|
1875
|
+
| ------------------- | --------------------------------------------------------- |
|
|
1876
|
+
| `ImmutableArray<a>` | A new array containing the new element at the given index |
|
|
1877
1877
|
|
|
1878
1878
|
Throws:
|
|
1879
1879
|
|
|
@@ -1915,16 +1915,16 @@ the elements of the second array.
|
|
|
1915
1915
|
|
|
1916
1916
|
Parameters:
|
|
1917
1917
|
|
|
1918
|
-
|param|type|description|
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1918
|
+
| param | type | description |
|
|
1919
|
+
| -------- | ------------------- | ---------------------------------------------- |
|
|
1920
|
+
| `array1` | `ImmutableArray<a>` | The array containing elements to appear first |
|
|
1921
|
+
| `array2` | `ImmutableArray<a>` | The array containing elements to appear second |
|
|
1922
1922
|
|
|
1923
1923
|
Returns:
|
|
1924
1924
|
|
|
1925
|
-
|type|description|
|
|
1926
|
-
|
|
1927
|
-
|
|
1925
|
+
| type | description |
|
|
1926
|
+
| ------------------- | ---------------------------------------------------------------------------------- |
|
|
1927
|
+
| `ImmutableArray<a>` | The new array containing elements from `array1` followed by elements from `array2` |
|
|
1928
1928
|
|
|
1929
1929
|
Examples:
|
|
1930
1930
|
|
|
@@ -1960,15 +1960,15 @@ provided list.
|
|
|
1960
1960
|
|
|
1961
1961
|
Parameters:
|
|
1962
1962
|
|
|
1963
|
-
|param|type|description|
|
|
1964
|
-
|
|
1965
|
-
|
|
1963
|
+
| param | type | description |
|
|
1964
|
+
| -------- | ------------------------- | --------------------------------------- |
|
|
1965
|
+
| `arrays` | `List<ImmutableArray<a>>` | A list containing all arrays to combine |
|
|
1966
1966
|
|
|
1967
1967
|
Returns:
|
|
1968
1968
|
|
|
1969
|
-
|type|description|
|
|
1970
|
-
|
|
1971
|
-
|
|
1969
|
+
| type | description |
|
|
1970
|
+
| ------------------- | ------------- |
|
|
1971
|
+
| `ImmutableArray<a>` | The new array |
|
|
1972
1972
|
|
|
1973
1973
|
Examples:
|
|
1974
1974
|
|
|
@@ -2004,16 +2004,16 @@ is called with the index of each array element.
|
|
|
2004
2004
|
|
|
2005
2005
|
Parameters:
|
|
2006
2006
|
|
|
2007
|
-
|param|type|description|
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2007
|
+
| param | type | description |
|
|
2008
|
+
| -------- | ------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
2009
|
+
| `length` | `Number` | The length of the new array |
|
|
2010
|
+
| `fn` | `Number => a` | The initializer function to call with each index, where the value returned will be used to initialize the element |
|
|
2011
2011
|
|
|
2012
2012
|
Returns:
|
|
2013
2013
|
|
|
2014
|
-
|type|description|
|
|
2015
|
-
|
|
2016
|
-
|
|
2014
|
+
| type | description |
|
|
2015
|
+
| ------------------- | ------------- |
|
|
2016
|
+
| `ImmutableArray<a>` | The new array |
|
|
2017
2017
|
|
|
2018
2018
|
Examples:
|
|
2019
2019
|
|
|
@@ -2050,16 +2050,16 @@ initialized with the given value.
|
|
|
2050
2050
|
|
|
2051
2051
|
Parameters:
|
|
2052
2052
|
|
|
2053
|
-
|param|type|description|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2053
|
+
| param | type | description |
|
|
2054
|
+
| -------- | -------- | -------------------------------- |
|
|
2055
|
+
| `length` | `Number` | The length of the new array |
|
|
2056
|
+
| `value` | `a` | The value to store at each index |
|
|
2057
2057
|
|
|
2058
2058
|
Returns:
|
|
2059
2059
|
|
|
2060
|
-
|type|description|
|
|
2061
|
-
|
|
2062
|
-
|
|
2060
|
+
| type | description |
|
|
2061
|
+
| ------------------- | ------------- |
|
|
2062
|
+
| `ImmutableArray<a>` | The new array |
|
|
2063
2063
|
|
|
2064
2064
|
Examples:
|
|
2065
2065
|
|
|
@@ -2090,10 +2090,10 @@ Iterates an array, calling an iterator function on each element.
|
|
|
2090
2090
|
|
|
2091
2091
|
Parameters:
|
|
2092
2092
|
|
|
2093
|
-
|param|type|description|
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2093
|
+
| param | type | description |
|
|
2094
|
+
| ------- | ------------------- | ----------------------------------------------- |
|
|
2095
|
+
| `fn` | `a => Void` | The iterator function to call with each element |
|
|
2096
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2097
2097
|
|
|
2098
2098
|
Examples:
|
|
2099
2099
|
|
|
@@ -2127,11 +2127,11 @@ Iterates an array a given number of times, calling an iterator function on each
|
|
|
2127
2127
|
|
|
2128
2128
|
Parameters:
|
|
2129
2129
|
|
|
2130
|
-
|param|type|description|
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2130
|
+
| param | type | description |
|
|
2131
|
+
| ------- | ------------------- | ----------------------------------------------- |
|
|
2132
|
+
| `fn` | `a => Void` | The iterator function to call with each element |
|
|
2133
|
+
| `n` | `Number` | The number of times to iterate the given array |
|
|
2134
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2135
2135
|
|
|
2136
2136
|
Examples:
|
|
2137
2137
|
|
|
@@ -2166,16 +2166,16 @@ called on each element of the input array.
|
|
|
2166
2166
|
|
|
2167
2167
|
Parameters:
|
|
2168
2168
|
|
|
2169
|
-
|param|type|description|
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2169
|
+
| param | type | description |
|
|
2170
|
+
| ------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
2171
|
+
| `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 array |
|
|
2172
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2173
2173
|
|
|
2174
2174
|
Returns:
|
|
2175
2175
|
|
|
2176
|
-
|type|description|
|
|
2177
|
-
|
|
2178
|
-
|
|
2176
|
+
| type | description |
|
|
2177
|
+
| ------------------- | -------------------------------- |
|
|
2178
|
+
| `ImmutableArray<b>` | The new array with mapped values |
|
|
2179
2179
|
|
|
2180
2180
|
Examples:
|
|
2181
2181
|
|
|
@@ -2214,17 +2214,17 @@ returned. The accumulator starts with value `initial`.
|
|
|
2214
2214
|
|
|
2215
2215
|
Parameters:
|
|
2216
2216
|
|
|
2217
|
-
|param|type|description|
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2217
|
+
| param | type | description |
|
|
2218
|
+
| --------- | ------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
2219
|
+
| `fn` | `(a, b) => a` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
2220
|
+
| `initial` | `a` | The initial value to use for the accumulator on the first iteration |
|
|
2221
|
+
| `array` | `ImmutableArray<b>` | The array to iterate |
|
|
2222
2222
|
|
|
2223
2223
|
Returns:
|
|
2224
2224
|
|
|
2225
|
-
|type|description|
|
|
2226
|
-
|
|
2227
|
-
|
|
2225
|
+
| type | description |
|
|
2226
|
+
| ---- | ---------------------------------------- |
|
|
2227
|
+
| `a` | The final accumulator returned from `fn` |
|
|
2228
2228
|
|
|
2229
2229
|
Examples:
|
|
2230
2230
|
|
|
@@ -2262,17 +2262,17 @@ returned. The accumulator starts with value `initial`.
|
|
|
2262
2262
|
|
|
2263
2263
|
Parameters:
|
|
2264
2264
|
|
|
2265
|
-
|param|type|description|
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2265
|
+
| param | type | description |
|
|
2266
|
+
| --------- | ------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
2267
|
+
| `fn` | `(a, b) => b` | The reducer function to call on each element, where the value returned will be the next accumulator value |
|
|
2268
|
+
| `initial` | `b` | The initial value to use for the accumulator on the first iteration |
|
|
2269
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2270
2270
|
|
|
2271
2271
|
Returns:
|
|
2272
2272
|
|
|
2273
|
-
|type|description|
|
|
2274
|
-
|
|
2275
|
-
|
|
2273
|
+
| type | description |
|
|
2274
|
+
| ---- | ---------------------------------------- |
|
|
2275
|
+
| `b` | The final accumulator returned from `fn` |
|
|
2276
2276
|
|
|
2277
2277
|
Examples:
|
|
2278
2278
|
|
|
@@ -2309,16 +2309,16 @@ of all results.
|
|
|
2309
2309
|
|
|
2310
2310
|
Parameters:
|
|
2311
2311
|
|
|
2312
|
-
|param|type|description|
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2312
|
+
| param | type | description |
|
|
2313
|
+
| ------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
|
2314
|
+
| `fn` | `a => ImmutableArray<b>` | The function to be called on each element, where the value returned will be an array that gets appended to the new array |
|
|
2315
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2316
2316
|
|
|
2317
2317
|
Returns:
|
|
2318
2318
|
|
|
2319
|
-
|type|description|
|
|
2320
|
-
|
|
2321
|
-
|
|
2319
|
+
| type | description |
|
|
2320
|
+
| ------------------- | ------------- |
|
|
2321
|
+
| `ImmutableArray<b>` | The new array |
|
|
2322
2322
|
|
|
2323
2323
|
Examples:
|
|
2324
2324
|
|
|
@@ -2351,15 +2351,15 @@ Converts the input list to an array.
|
|
|
2351
2351
|
|
|
2352
2352
|
Parameters:
|
|
2353
2353
|
|
|
2354
|
-
|param|type|description|
|
|
2355
|
-
|
|
2356
|
-
|
|
2354
|
+
| param | type | description |
|
|
2355
|
+
| ------ | --------- | ------------------- |
|
|
2356
|
+
| `list` | `List<a>` | The list to convert |
|
|
2357
2357
|
|
|
2358
2358
|
Returns:
|
|
2359
2359
|
|
|
2360
|
-
|type|description|
|
|
2361
|
-
|
|
2362
|
-
|
|
2360
|
+
| type | description |
|
|
2361
|
+
| ------------------- | ----------------------------------------------- |
|
|
2362
|
+
| `ImmutableArray<a>` | The array containing all elements from the list |
|
|
2363
2363
|
|
|
2364
2364
|
Examples:
|
|
2365
2365
|
|
|
@@ -2391,15 +2391,15 @@ Converts the input array to a list.
|
|
|
2391
2391
|
|
|
2392
2392
|
Parameters:
|
|
2393
2393
|
|
|
2394
|
-
|param|type|description|
|
|
2395
|
-
|
|
2396
|
-
|
|
2394
|
+
| param | type | description |
|
|
2395
|
+
| ------- | ------------------- | -------------------- |
|
|
2396
|
+
| `array` | `ImmutableArray<a>` | The array to convert |
|
|
2397
2397
|
|
|
2398
2398
|
Returns:
|
|
2399
2399
|
|
|
2400
|
-
|type|description|
|
|
2401
|
-
|
|
2402
|
-
|
|
2400
|
+
| type | description |
|
|
2401
|
+
| --------- | ----------------------------------------------- |
|
|
2402
|
+
| `List<a>` | The list containing all elements from the array |
|
|
2403
2403
|
|
|
2404
2404
|
Examples:
|
|
2405
2405
|
|
|
@@ -2434,16 +2434,16 @@ the condition.
|
|
|
2434
2434
|
|
|
2435
2435
|
Parameters:
|
|
2436
2436
|
|
|
2437
|
-
|param|type|description|
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2437
|
+
| param | type | description |
|
|
2438
|
+
| ------- | ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
2439
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
2440
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2441
2441
|
|
|
2442
2442
|
Returns:
|
|
2443
2443
|
|
|
2444
|
-
|type|description|
|
|
2445
|
-
|
|
2446
|
-
|
|
2444
|
+
| type | description |
|
|
2445
|
+
| ------------------- | ------------------------------------------------------------ |
|
|
2446
|
+
| `ImmutableArray<a>` | The new array containing elements where `fn` returned `true` |
|
|
2447
2447
|
|
|
2448
2448
|
Examples:
|
|
2449
2449
|
|
|
@@ -2477,16 +2477,16 @@ elements in the input array.
|
|
|
2477
2477
|
|
|
2478
2478
|
Parameters:
|
|
2479
2479
|
|
|
2480
|
-
|param|type|description|
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2480
|
+
| param | type | description |
|
|
2481
|
+
| ------- | ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
2482
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
2483
|
+
| `array` | `ImmutableArray<a>` | The array to check |
|
|
2484
2484
|
|
|
2485
2485
|
Returns:
|
|
2486
2486
|
|
|
2487
|
-
|type|description|
|
|
2488
|
-
|
|
2489
|
-
|
|
2487
|
+
| type | description |
|
|
2488
|
+
| ------ | ----------------------------------------------------------------- |
|
|
2489
|
+
| `Bool` | `true` if all elements satisfy the condition or `false` otherwise |
|
|
2490
2490
|
|
|
2491
2491
|
Examples:
|
|
2492
2492
|
|
|
@@ -2525,16 +2525,16 @@ once** by an element in the input array.
|
|
|
2525
2525
|
|
|
2526
2526
|
Parameters:
|
|
2527
2527
|
|
|
2528
|
-
|param|type|description|
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2528
|
+
| param | type | description |
|
|
2529
|
+
| ------- | ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
2530
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
2531
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2532
2532
|
|
|
2533
2533
|
Returns:
|
|
2534
2534
|
|
|
2535
|
-
|type|description|
|
|
2536
|
-
|
|
2537
|
-
|
|
2535
|
+
| type | description |
|
|
2536
|
+
| ------ | ------------------------------------------------------------------------- |
|
|
2537
|
+
| `Bool` | `true` if one or more elements satisfy the condition or `false` otherwise |
|
|
2538
2538
|
|
|
2539
2539
|
Examples:
|
|
2540
2540
|
|
|
@@ -2572,15 +2572,15 @@ Creates a new array with all elements in reverse order.
|
|
|
2572
2572
|
|
|
2573
2573
|
Parameters:
|
|
2574
2574
|
|
|
2575
|
-
|param|type|description|
|
|
2576
|
-
|
|
2577
|
-
|
|
2575
|
+
| param | type | description |
|
|
2576
|
+
| ------- | ------------------- | -------------------- |
|
|
2577
|
+
| `array` | `ImmutableArray<a>` | The array to reverse |
|
|
2578
2578
|
|
|
2579
2579
|
Returns:
|
|
2580
2580
|
|
|
2581
|
-
|type|description|
|
|
2582
|
-
|
|
2583
|
-
|
|
2581
|
+
| type | description |
|
|
2582
|
+
| ------------------- | ------------- |
|
|
2583
|
+
| `ImmutableArray<a>` | The new array |
|
|
2584
2584
|
|
|
2585
2585
|
Examples:
|
|
2586
2586
|
|
|
@@ -2614,16 +2614,16 @@ Uses the generic `==` structural equality operator.
|
|
|
2614
2614
|
|
|
2615
2615
|
Parameters:
|
|
2616
2616
|
|
|
2617
|
-
|param|type|description|
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2617
|
+
| param | type | description |
|
|
2618
|
+
| -------- | ------------------- | -------------------- |
|
|
2619
|
+
| `search` | `a` | The value to compare |
|
|
2620
|
+
| `array` | `ImmutableArray<a>` | The array to inspect |
|
|
2621
2621
|
|
|
2622
2622
|
Returns:
|
|
2623
2623
|
|
|
2624
|
-
|type|description|
|
|
2625
|
-
|
|
2626
|
-
|
|
2624
|
+
| type | description |
|
|
2625
|
+
| ------ | ------------------------------------------------------------ |
|
|
2626
|
+
| `Bool` | `true` if the value exists in the array or `false` otherwise |
|
|
2627
2627
|
|
|
2628
2628
|
Examples:
|
|
2629
2629
|
|
|
@@ -2661,16 +2661,16 @@ Finds the first element in an array that satisfies the given condition.
|
|
|
2661
2661
|
|
|
2662
2662
|
Parameters:
|
|
2663
2663
|
|
|
2664
|
-
|param|type|description|
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2664
|
+
| param | type | description |
|
|
2665
|
+
| ------- | ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
2666
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
2667
|
+
| `array` | `ImmutableArray<a>` | The array to search |
|
|
2668
2668
|
|
|
2669
2669
|
Returns:
|
|
2670
2670
|
|
|
2671
|
-
|type|description|
|
|
2672
|
-
|
|
2673
|
-
|
|
2671
|
+
| type | description |
|
|
2672
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
2673
|
+
| `Option<a>` | `Some(element)` containing the first value found or `None` otherwise |
|
|
2674
2674
|
|
|
2675
2675
|
Examples:
|
|
2676
2676
|
|
|
@@ -2708,16 +2708,16 @@ Finds the first index in an array where the element satisfies the given conditio
|
|
|
2708
2708
|
|
|
2709
2709
|
Parameters:
|
|
2710
2710
|
|
|
2711
|
-
|param|type|description|
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2711
|
+
| param | type | description |
|
|
2712
|
+
| ------- | ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
2713
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
2714
|
+
| `array` | `ImmutableArray<a>` | The array to search |
|
|
2715
2715
|
|
|
2716
2716
|
Returns:
|
|
2717
2717
|
|
|
2718
|
-
|type|description|
|
|
2719
|
-
|
|
2720
|
-
|
|
2718
|
+
| type | description |
|
|
2719
|
+
| ---------------- | --------------------------------------------------------------------------------- |
|
|
2720
|
+
| `Option<Number>` | `Some(index)` containing the index of the first element found or `None` otherwise |
|
|
2721
2721
|
|
|
2722
2722
|
Examples:
|
|
2723
2723
|
|
|
@@ -2758,16 +2758,16 @@ all ordered pairs `(a, b)`.
|
|
|
2758
2758
|
|
|
2759
2759
|
Parameters:
|
|
2760
2760
|
|
|
2761
|
-
|param|type|description|
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2761
|
+
| param | type | description |
|
|
2762
|
+
| -------- | ------------------- | -------------------------------------------------------- |
|
|
2763
|
+
| `array1` | `ImmutableArray<a>` | The array to provide values for the first tuple element |
|
|
2764
|
+
| `array2` | `ImmutableArray<b>` | The array to provide values for the second tuple element |
|
|
2765
2765
|
|
|
2766
2766
|
Returns:
|
|
2767
2767
|
|
|
2768
|
-
|type|description|
|
|
2769
|
-
|
|
2770
|
-
|
|
2768
|
+
| type | description |
|
|
2769
|
+
| ------------------------ | ---------------------------------------------- |
|
|
2770
|
+
| `ImmutableArray<(a, b)>` | The new array containing all pairs of `(a, b)` |
|
|
2771
2771
|
|
|
2772
2772
|
Examples:
|
|
2773
2773
|
|
|
@@ -2800,16 +2800,16 @@ Counts the number of elements in an array that satisfy the given condition.
|
|
|
2800
2800
|
|
|
2801
2801
|
Parameters:
|
|
2802
2802
|
|
|
2803
|
-
|param|type|description|
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2803
|
+
| param | type | description |
|
|
2804
|
+
| ------- | ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
2805
|
+
| `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
|
|
2806
|
+
| `array` | `ImmutableArray<a>` | The array to iterate |
|
|
2807
2807
|
|
|
2808
2808
|
Returns:
|
|
2809
2809
|
|
|
2810
|
-
|type|description|
|
|
2811
|
-
|
|
2812
|
-
|
|
2810
|
+
| type | description |
|
|
2811
|
+
| -------- | ------------------------------------------------------- |
|
|
2812
|
+
| `Number` | The total number of elements that satisfy the condition |
|
|
2813
2813
|
|
|
2814
2814
|
Examples:
|
|
2815
2815
|
|
|
@@ -2842,15 +2842,15 @@ Uses the generic `==` structural equality operator.
|
|
|
2842
2842
|
|
|
2843
2843
|
Parameters:
|
|
2844
2844
|
|
|
2845
|
-
|param|type|description|
|
|
2846
|
-
|
|
2847
|
-
|
|
2845
|
+
| param | type | description |
|
|
2846
|
+
| ------- | ------------------- | ------------------- |
|
|
2847
|
+
| `array` | `ImmutableArray<a>` | The array to filter |
|
|
2848
2848
|
|
|
2849
2849
|
Returns:
|
|
2850
2850
|
|
|
2851
|
-
|type|description|
|
|
2852
|
-
|
|
2853
|
-
|
|
2851
|
+
| type | description |
|
|
2852
|
+
| ------------------- | ------------------------------------- |
|
|
2853
|
+
| `ImmutableArray<a>` | The new array with only unique values |
|
|
2854
2854
|
|
|
2855
2855
|
Examples:
|
|
2856
2856
|
|
|
@@ -2889,16 +2889,16 @@ array to have the length of the smaller array.
|
|
|
2889
2889
|
|
|
2890
2890
|
Parameters:
|
|
2891
2891
|
|
|
2892
|
-
|param|type|description|
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2892
|
+
| param | type | description |
|
|
2893
|
+
| -------- | ------------------- | -------------------------------------------------------- |
|
|
2894
|
+
| `array1` | `ImmutableArray<a>` | The array to provide values for the first tuple element |
|
|
2895
|
+
| `array2` | `ImmutableArray<b>` | The array to provide values for the second tuple element |
|
|
2896
2896
|
|
|
2897
2897
|
Returns:
|
|
2898
2898
|
|
|
2899
|
-
|type|description|
|
|
2900
|
-
|
|
2901
|
-
|
|
2899
|
+
| type | description |
|
|
2900
|
+
| ------------------------ | -------------------------------------------------- |
|
|
2901
|
+
| `ImmutableArray<(a, b)>` | The new array containing indexed pairs of `(a, b)` |
|
|
2902
2902
|
|
|
2903
2903
|
Examples:
|
|
2904
2904
|
|
|
@@ -2940,17 +2940,17 @@ array to have the length of the smaller array.
|
|
|
2940
2940
|
|
|
2941
2941
|
Parameters:
|
|
2942
2942
|
|
|
2943
|
-
|param|type|description|
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2943
|
+
| param | type | description |
|
|
2944
|
+
| -------- | ------------------- | ----------------------------------------------------------------------------------- |
|
|
2945
|
+
| `fn` | `(a, b) => c` | The function to apply to pairs of elements |
|
|
2946
|
+
| `array1` | `ImmutableArray<a>` | The array whose elements will each be passed to the function as the first argument |
|
|
2947
|
+
| `array2` | `ImmutableArray<b>` | The array whose elements will each be passed to the function as the second argument |
|
|
2948
2948
|
|
|
2949
2949
|
Returns:
|
|
2950
2950
|
|
|
2951
|
-
|type|description|
|
|
2952
|
-
|
|
2953
|
-
|
|
2951
|
+
| type | description |
|
|
2952
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
2953
|
+
| `ImmutableArray<c>` | The new array containing elements derived from applying the function to pairs of input array elements |
|
|
2954
2954
|
|
|
2955
2955
|
Examples:
|
|
2956
2956
|
|
|
@@ -2991,15 +2991,15 @@ Produces two arrays by splitting apart an array of tuples.
|
|
|
2991
2991
|
|
|
2992
2992
|
Parameters:
|
|
2993
2993
|
|
|
2994
|
-
|param|type|description|
|
|
2995
|
-
|
|
2996
|
-
|
|
2994
|
+
| param | type | description |
|
|
2995
|
+
| ------- | ------------------------ | ---------------------------- |
|
|
2996
|
+
| `array` | `ImmutableArray<(a, b)>` | The array of tuples to split |
|
|
2997
2997
|
|
|
2998
2998
|
Returns:
|
|
2999
2999
|
|
|
3000
|
-
|type|description|
|
|
3001
|
-
|
|
3002
|
-
|
|
3000
|
+
| type | description |
|
|
3001
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
3002
|
+
| `(ImmutableArray<a>, ImmutableArray<b>)` | An array containing all elements from the first tuple element and an array containing all elements from the second tuple element |
|
|
3003
3003
|
|
|
3004
3004
|
Examples:
|
|
3005
3005
|
|
|
@@ -3033,16 +3033,16 @@ Concatenates an array of strings into a single string, separated by a separator
|
|
|
3033
3033
|
|
|
3034
3034
|
Parameters:
|
|
3035
3035
|
|
|
3036
|
-
|param|type|description|
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3036
|
+
| param | type | description |
|
|
3037
|
+
| ----------- | ------------------------ | --------------------------------------------------- |
|
|
3038
|
+
| `separator` | `String` | The separator to insert between items in the string |
|
|
3039
|
+
| `array` | `ImmutableArray<String>` | The input strings |
|
|
3040
3040
|
|
|
3041
3041
|
Returns:
|
|
3042
3042
|
|
|
3043
|
-
|type|description|
|
|
3044
|
-
|
|
3045
|
-
|
|
3043
|
+
| type | description |
|
|
3044
|
+
| -------- | ----------------------- |
|
|
3045
|
+
| `String` | The concatenated string |
|
|
3046
3046
|
|
|
3047
3047
|
Examples:
|
|
3048
3048
|
|
|
@@ -3081,17 +3081,17 @@ the end of the array.
|
|
|
3081
3081
|
|
|
3082
3082
|
Parameters:
|
|
3083
3083
|
|
|
3084
|
-
|param|type|description|
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3084
|
+
| param | type | description |
|
|
3085
|
+
| ------- | ------------------- | ------------------------------------------------------------- |
|
|
3086
|
+
| `start` | `Number` | The index of the array where the slice will begin (inclusive) |
|
|
3087
|
+
| `?end` | `Number` | The index of the array where the slice will end (exclusive) |
|
|
3088
|
+
| `array` | `ImmutableArray<a>` | The array to be sliced |
|
|
3089
3089
|
|
|
3090
3090
|
Returns:
|
|
3091
3091
|
|
|
3092
|
-
|type|description|
|
|
3093
|
-
|
|
3094
|
-
|
|
3092
|
+
| type | description |
|
|
3093
|
+
| ------------------- | --------------------------------------- |
|
|
3094
|
+
| `ImmutableArray<a>` | The subset of the array that was sliced |
|
|
3095
3095
|
|
|
3096
3096
|
Examples:
|
|
3097
3097
|
|
|
@@ -3133,16 +3133,16 @@ Ordering is calculated using a comparator function which takes two array element
|
|
|
3133
3133
|
|
|
3134
3134
|
Parameters:
|
|
3135
3135
|
|
|
3136
|
-
|param|type|description|
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3136
|
+
| param | type | description |
|
|
3137
|
+
| ---------- | ------------------------------ | --------------------------------------------------- |
|
|
3138
|
+
| `?compare` | `(num1: a, num2: a) => Number` | The comparator function used to indicate sort order |
|
|
3139
|
+
| `array` | `ImmutableArray<a>` | The array to be sorted |
|
|
3140
3140
|
|
|
3141
3141
|
Returns:
|
|
3142
3142
|
|
|
3143
|
-
|type|description|
|
|
3144
|
-
|
|
3145
|
-
|
|
3143
|
+
| type | description |
|
|
3144
|
+
| ------------------- | ---------------- |
|
|
3145
|
+
| `ImmutableArray<a>` | The sorted array |
|
|
3146
3146
|
|
|
3147
3147
|
Examples:
|
|
3148
3148
|
|
|
@@ -3178,10 +3178,10 @@ specified amount to the right. See examples.
|
|
|
3178
3178
|
|
|
3179
3179
|
Parameters:
|
|
3180
3180
|
|
|
3181
|
-
|param|type|description|
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3181
|
+
| param | type | description |
|
|
3182
|
+
| ------- | ------------------- | ----------------------------------- |
|
|
3183
|
+
| `n` | `Number` | The number of elements to rotate by |
|
|
3184
|
+
| `array` | `ImmutableArray<a>` | The array to be rotated |
|
|
3185
3185
|
|
|
3186
3186
|
Examples:
|
|
3187
3187
|
|