You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/getting_grain.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,30 +22,30 @@ _The `--no-quarantine` flag will avoid having to approve the binary in the Secur
22
22
23
23
### MacOS x64 - Download
24
24
25
-
If you'd prefer not to use homebrew, you can [download it](https://github.com/grain-lang/grain/releases/download/grain-v0.4.4/grain-mac-x64) directly from GitHub or using `curl`.
25
+
If you'd prefer not to use homebrew, you can [download it](https://github.com/grain-lang/grain/releases/download/grain-v0.4.5/grain-mac-x64) directly from GitHub or using `curl`.
Copy file name to clipboardExpand all lines: src/stdlib/array.md
+60-5Lines changed: 60 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -371,7 +371,7 @@ Returns:
371
371
372
372
|type|description|
373
373
|----|-----------|
374
-
|`Array<a>`|The new array with mapped values|
374
+
|`Array<b>`|The new array with mapped values|
375
375
376
376
### Array.**mapi**
377
377
@@ -398,7 +398,7 @@ Returns:
398
398
399
399
|type|description|
400
400
|----|-----------|
401
-
|`Array<a>`|The new array with mapped values|
401
+
|`Array<b>`|The new array with mapped values|
402
402
403
403
### Array.**reduce**
404
404
@@ -425,7 +425,7 @@ Parameters:
425
425
|-----|----|-----------|
426
426
|`fn`|`(a, b) -> a`|The reducer function to call on each element, where the value returned will be the next accumulator value|
427
427
|`initial`|`a`|The initial value to use for the accumulator on the first iteration|
428
-
|`array`|`Array<a>`|The array to iterate|
428
+
|`array`|`Array<b>`|The array to iterate|
429
429
430
430
Returns:
431
431
@@ -465,7 +465,7 @@ Parameters:
465
465
|-----|----|-----------|
466
466
|`fn`|`(a, b, Number) -> a`|The reducer function to call on each element, where the value returned will be the next accumulator value|
467
467
|`initial`|`a`|The initial value to use for the accumulator on the first iteration|
468
-
|`array`|`Array<a>`|The array to iterate|
468
+
|`array`|`Array<b>`|The array to iterate|
469
469
470
470
Returns:
471
471
@@ -500,7 +500,7 @@ Returns:
500
500
501
501
|type|description|
502
502
|----|-----------|
503
-
|`Array<a>`|The new array|
503
+
|`Array<b>`|The new array|
504
504
505
505
### Array.**every**
506
506
@@ -1027,3 +1027,58 @@ Returns:
1027
1027
|----|-----------|
1028
1028
|`Array<a>`|The subset of the array that was sliced|
1029
1029
1030
+
### Array.**sort**
1031
+
1032
+
<detailsdisabled>
1033
+
<summarytabindex="-1">Added in <code>next</code></summary>
1034
+
No other changes yet.
1035
+
</details>
1036
+
1037
+
```grain
1038
+
sort : (((a, a) -> Number), Array<a>) -> Void
1039
+
```
1040
+
1041
+
Sorts an array in-place.
1042
+
1043
+
Ordering is calculated using a comparator function which takes two array elements and must return 0 if both are equal, a positive number if the first is greater, and a negative number if the first is smaller.
1044
+
1045
+
Parameters:
1046
+
1047
+
|param|type|description|
1048
+
|-----|----|-----------|
1049
+
|`comp`|`(a, a) -> Number`|The comparator function used to indicate sort order|
1050
+
|`array`|`Array<a>`|The array to be sorted|
1051
+
1052
+
### Array.**rotate**
1053
+
1054
+
<detailsdisabled>
1055
+
<summarytabindex="-1">Added in <code>next</code></summary>
1056
+
No other changes yet.
1057
+
</details>
1058
+
1059
+
```grain
1060
+
rotate : (Number, Array<a>) -> Void
1061
+
```
1062
+
1063
+
Rotates an array by n elements to the right, in place.
1064
+
1065
+
If n is negative, the array will be rotated by n elements
1066
+
to the left. See examples.
1067
+
1068
+
Parameters:
1069
+
1070
+
|param|type|description|
1071
+
|-----|----|-----------|
1072
+
|`n`|`Number`|The number of elements to rotate by|
0 commit comments