Skip to content

Commit 0a0d489

Browse files
committed
chore: Update website for grain-v0.4.5
1 parent a9c55d8 commit 0a0d489

File tree

10 files changed

+1437
-142
lines changed

10 files changed

+1437
-142
lines changed

src/getting_grain.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@ _The `--no-quarantine` flag will avoid having to approve the binary in the Secur
2222

2323
### MacOS x64 - Download
2424

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`.
2626

2727
```sh
2828
sudo curl -L --output /usr/local/bin/grain \
29-
https://github.com/grain-lang/grain/releases/download/grain-v0.4.4/grain-mac-x64 \
29+
https://github.com/grain-lang/grain/releases/download/grain-v0.4.5/grain-mac-x64 \
3030
&& sudo chmod +x /usr/local/bin/grain
3131
```
3232

3333
### Linux x64 - Download
3434

35-
You can [download it](https://github.com/grain-lang/grain/releases/download/grain-v0.4.4/grain-linux-x64) directly from GitHub or using `curl`.
35+
You can [download it](https://github.com/grain-lang/grain/releases/download/grain-v0.4.5/grain-linux-x64) directly from GitHub or using `curl`.
3636

3737
```sh
3838
sudo curl -L --output /usr/local/bin/grain \
39-
https://github.com/grain-lang/grain/releases/download/grain-v0.4.4/grain-linux-x64 \
39+
https://github.com/grain-lang/grain/releases/download/grain-v0.4.5/grain-linux-x64 \
4040
&& sudo chmod +x /usr/local/bin/grain
4141
```
4242

4343
### Windows x64 - Download
4444

45-
You can [download it](https://github.com/grain-lang/grain/releases/download/grain-v0.4.4/grain-win-x64.exe) directly from GitHub or using `curl`.
45+
You can [download it](https://github.com/grain-lang/grain/releases/download/grain-v0.4.5/grain-win-x64.exe) directly from GitHub or using `curl`.
4646

4747
```batch
48-
curl -LO https://github.com/grain-lang/grain/releases/download/grain-v0.4.4/grain-win-x64.exe
48+
curl -LO https://github.com/grain-lang/grain/releases/download/grain-v0.4.5/grain-win-x64.exe
4949
```
5050

5151
You'll either want to put it into your path or keep it inside your project and invoke with `.\grain-win-x64.exe`.

src/stdlib/array.md

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Returns:
371371

372372
|type|description|
373373
|----|-----------|
374-
|`Array<a>`|The new array with mapped values|
374+
|`Array<b>`|The new array with mapped values|
375375

376376
### Array.**mapi**
377377

@@ -398,7 +398,7 @@ Returns:
398398

399399
|type|description|
400400
|----|-----------|
401-
|`Array<a>`|The new array with mapped values|
401+
|`Array<b>`|The new array with mapped values|
402402

403403
### Array.**reduce**
404404

@@ -425,7 +425,7 @@ Parameters:
425425
|-----|----|-----------|
426426
|`fn`|`(a, b) -> a`|The reducer function to call on each element, where the value returned will be the next accumulator value|
427427
|`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|
429429

430430
Returns:
431431

@@ -465,7 +465,7 @@ Parameters:
465465
|-----|----|-----------|
466466
|`fn`|`(a, b, Number) -> a`|The reducer function to call on each element, where the value returned will be the next accumulator value|
467467
|`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|
469469

470470
Returns:
471471

@@ -500,7 +500,7 @@ Returns:
500500

501501
|type|description|
502502
|----|-----------|
503-
|`Array<a>`|The new array|
503+
|`Array<b>`|The new array|
504504

505505
### Array.**every**
506506

@@ -1027,3 +1027,58 @@ Returns:
10271027
|----|-----------|
10281028
|`Array<a>`|The subset of the array that was sliced|
10291029

1030+
### Array.**sort**
1031+
1032+
<details disabled>
1033+
<summary tabindex="-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+
<details disabled>
1055+
<summary tabindex="-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|
1073+
|`arr`|`Array<a>`|The array to be rotated|
1074+
1075+
Examples:
1076+
1077+
```grain
1078+
let array = [> 1, 2, 3, 4, 5]; rotate(2, arr); arr == [> 4, 5, 1, 2, 3]
1079+
```
1080+
1081+
```grain
1082+
let array = [> 1, 2, 3, 4, 5]; rotate(-1, arr); arr == [> 2, 3, 4, 5, 1]
1083+
```
1084+

src/stdlib/number.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,35 @@ Returns:
422422
|----|-----------|
423423
|`Bool`|`true` if the value is infinite, otherwise `false`|
424424

425+
### Number.**parseInt**
426+
427+
<details disabled>
428+
<summary tabindex="-1">Added in <code>next</code></summary>
429+
No other changes yet.
430+
</details>
431+
432+
```grain
433+
parseInt : (String, Number) -> Result<Number, String>
434+
```
435+
436+
Parses a string representation of an integer into a `Number` using the
437+
specified radix (also known as a number system "base").
438+
439+
If the string has a radix prefix (i.e. "0x"/"0X", "0o"/"0O", or "0b"/"0B"
440+
for radixes 16, 8, or 2 respectively), the supplied radix is ignored in
441+
favor of the prefix. Underscores that appear in the numeric portion of the
442+
input are ignored.
443+
444+
Parameters:
445+
446+
|param|type|description|
447+
|-----|----|-----------|
448+
|`input`|`String`|The string to parse|
449+
|`radix`|`Number`|The number system base to use when parsing the input string|
450+
451+
Returns:
452+
453+
|type|description|
454+
|----|-----------|
455+
|`Result<Number, String>`|`Ok(value)` containing the parsed number on a successful parse or `Err(msg)` containing an error message string otherwise|
456+

0 commit comments

Comments
 (0)