@grain/stdlib 0.5.0 → 0.5.3
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 +41 -0
- package/array.gr +56 -1
- package/array.md +83 -0
- package/bigint.md +61 -61
- package/buffer.gr +33 -31
- package/buffer.md +1 -1
- package/bytes.md +1 -1
- package/exception.gr +28 -2
- package/exception.md +37 -0
- package/float32.gr +50 -30
- package/float32.md +69 -30
- package/float64.gr +55 -34
- package/float64.md +69 -30
- package/immutablepriorityqueue.gr +332 -0
- package/immutablepriorityqueue.md +248 -0
- package/int32.md +4 -4
- package/int64.md +4 -4
- package/list.gr +73 -0
- package/list.md +110 -0
- package/map.gr +1 -2
- package/map.md +1 -1
- package/marshal.gr +1058 -0
- package/marshal.md +76 -0
- package/number.gr +122 -0
- package/number.md +172 -0
- package/package.json +1 -1
- package/pervasives.gr +16 -5
- package/pervasives.md +28 -0
- package/priorityqueue.gr +241 -0
- package/priorityqueue.md +279 -0
- package/random.md +7 -7
- package/regex.gr +5 -5
- package/runtime/compare.gr +178 -0
- package/runtime/compare.md +6 -0
- package/runtime/equal.gr +1 -2
- package/runtime/numbers.gr +331 -86
- package/runtime/numbers.md +24 -0
- package/set.gr +1 -2
- package/set.md +1 -1
- package/string.gr +97 -15
- package/string.md +65 -1
- package/sys/file.gr +3 -3
- package/sys/file.md +3 -3
- package/sys/process.gr +3 -3
- package/sys/process.md +3 -3
- package/sys/random.gr +2 -2
- package/sys/random.md +4 -4
- package/sys/time.gr +2 -2
- package/sys/time.md +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
### [0.5.3](https://github.com/grain-lang/grain/compare/stdlib-v0.5.2...stdlib-v0.5.3) (2022-08-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Implement Pervasives.compare ([#1399](https://github.com/grain-lang/grain/issues/1399)) ([ebd87e4](https://github.com/grain-lang/grain/commit/ebd87e4308a8950fd95f060ebc446833b064237c))
|
|
9
|
+
* **stdlib:** Add `charCodeAt` function to String module ([#1376](https://github.com/grain-lang/grain/issues/1376)) ([c3abbc9](https://github.com/grain-lang/grain/commit/c3abbc991c8b05e3de20e670d2bc3e491feebf8a))
|
|
10
|
+
* **stdlib:** Add `lastIndexOf` function to String module ([#1372](https://github.com/grain-lang/grain/issues/1372)) ([b73d9bf](https://github.com/grain-lang/grain/commit/b73d9bf9ff3291b83e6f4263e392395d04dc9995))
|
|
11
|
+
* **stdlib:** Implement `isFloat`, `isInteger` & `isRational` in Number module ([#1393](https://github.com/grain-lang/grain/issues/1393)) ([0af0669](https://github.com/grain-lang/grain/commit/0af066993a2b80e417d2c625b27fd11cb1f1f55f))
|
|
12
|
+
* **stdlib:** Implement List.zip, List.unzip, List.zipWith, Array.reduceRight, Array.zipWith ([#1363](https://github.com/grain-lang/grain/issues/1363)) ([3e7c147](https://github.com/grain-lang/grain/commit/3e7c147fea2d2fb8b7c5a3d6b3eb1453f2861e36))
|
|
13
|
+
* **stdlib:** Implement mutable/immutable priority queues ([#1397](https://github.com/grain-lang/grain/issues/1397)) ([244be1b](https://github.com/grain-lang/grain/commit/244be1b7254caf0b451902ac56413382eb196747))
|
|
14
|
+
* **stdlib:** Marshal ([#1352](https://github.com/grain-lang/grain/issues/1352)) ([d659de2](https://github.com/grain-lang/grain/commit/d659de2d92260f7726164876827c639bfd9d0590))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **compiler:** Correctly handle underscores in bigint literals ([0af0669](https://github.com/grain-lang/grain/commit/0af066993a2b80e417d2c625b27fd11cb1f1f55f))
|
|
20
|
+
* **graindoc:** Use defined module name throughout generated doc ([#1406](https://github.com/grain-lang/grain/issues/1406)) ([c33a777](https://github.com/grain-lang/grain/commit/c33a777a93d5e40a081991db5e6ea61ade4fbabc))
|
|
21
|
+
* **stdlib:** Correctly promote numbers to bigints when left-shifting ([#1354](https://github.com/grain-lang/grain/issues/1354)) ([5280e98](https://github.com/grain-lang/grain/commit/5280e98a91a57fae074299fc7bad3c41f69fa2a3))
|
|
22
|
+
* **stdlib:** Prevent addBytesSlice throwing error on empty buffer ([#1394](https://github.com/grain-lang/grain/issues/1394)) ([bdd4be4](https://github.com/grain-lang/grain/commit/bdd4be46730290908b7b939f41679acce7834167))
|
|
23
|
+
|
|
24
|
+
### [0.5.2](https://github.com/grain-lang/grain/compare/stdlib-v0.5.1...stdlib-v0.5.2) (2022-06-29)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **stdlib:** Add number constants to number libraries ([#1331](https://github.com/grain-lang/grain/issues/1331)) ([f640ec2](https://github.com/grain-lang/grain/commit/f640ec20aa507c83c9cde290b911d0adcb4e8254))
|
|
30
|
+
* **stdlib:** Implement Number.sin and Number.cos ([#1343](https://github.com/grain-lang/grain/issues/1343)) ([9357126](https://github.com/grain-lang/grain/commit/93571267b7df53e1cb9f61eaebf8748885e7392c))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* **stdlib:** Make toNumber functions respect Number invariants ([#1347](https://github.com/grain-lang/grain/issues/1347)) ([78db882](https://github.com/grain-lang/grain/commit/78db8820cf5667a4d6737c9109f4223c1348b245))
|
|
36
|
+
|
|
37
|
+
### [0.5.1](https://github.com/grain-lang/grain/compare/stdlib-v0.5.0...stdlib-v0.5.1) (2022-06-08)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Miscellaneous Chores
|
|
41
|
+
|
|
42
|
+
* **stdlib:** Synchronize Grain versions
|
|
43
|
+
|
|
3
44
|
## [0.5.0](https://github.com/grain-lang/grain/compare/stdlib-v0.4.6...stdlib-v0.5.0) (2022-06-05)
|
|
4
45
|
|
|
5
46
|
|
package/array.gr
CHANGED
|
@@ -358,6 +358,32 @@ export let reduce = (fn, initial, array) => {
|
|
|
358
358
|
acc
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Combines all elements of an array using a reducer function,
|
|
363
|
+
* starting from the "end", or right side, of the array.
|
|
364
|
+
*
|
|
365
|
+
* In `Array.reduceRight(fn, initial, array)`, `fn` is called with
|
|
366
|
+
* each element of the array and an accumulator, and returns
|
|
367
|
+
* a new accumulator. The final value is the last accumulator
|
|
368
|
+
* returned. The accumulator starts with value `initial`.
|
|
369
|
+
*
|
|
370
|
+
* @param fn: The reducer function to call on each element, where the value returned will be the next accumulator value
|
|
371
|
+
* @param initial: The initial value to use for the accumulator on the first iteration
|
|
372
|
+
* @param array: The array to iterate
|
|
373
|
+
* @returns The final accumulator returned from `fn`
|
|
374
|
+
*
|
|
375
|
+
* @example Array.reduceRight((a, b) => b ++ a, "", [> "baz", "bar", "foo"]) // "foobarbaz"
|
|
376
|
+
*
|
|
377
|
+
* @since v0.5.3
|
|
378
|
+
*/
|
|
379
|
+
export let reduceRight = (fn, initial, array) => {
|
|
380
|
+
let mut acc = initial
|
|
381
|
+
for (let mut i = length(array) - 1; i >= 0; i -= 1) {
|
|
382
|
+
acc = fn(array[i], acc)
|
|
383
|
+
}
|
|
384
|
+
acc
|
|
385
|
+
}
|
|
386
|
+
|
|
361
387
|
/**
|
|
362
388
|
* Combines all elements of an array using a reducer function,
|
|
363
389
|
* starting from the "head", or left side, of the array.
|
|
@@ -555,7 +581,7 @@ export let fromList = list => {
|
|
|
555
581
|
* @since v0.2.0
|
|
556
582
|
*/
|
|
557
583
|
export let contains = (search, array) => {
|
|
558
|
-
// TODO: This should use recursion
|
|
584
|
+
// TODO(#189): This should be rewritten to use recursion and pattern matching
|
|
559
585
|
let len = length(array)
|
|
560
586
|
let mut found = false
|
|
561
587
|
for (let mut index = 0; !found && index < len; index += 1) {
|
|
@@ -787,6 +813,35 @@ export let zip = (array1: Array<a>, array2: Array<b>) => {
|
|
|
787
813
|
}
|
|
788
814
|
}
|
|
789
815
|
|
|
816
|
+
/**
|
|
817
|
+
* Produces a new array filled with elements defined by applying a function on
|
|
818
|
+
* pairs from both given arrays. The first element will contain the result of
|
|
819
|
+
* applying the function to the first elements of each array, the second element
|
|
820
|
+
* will contain the result of applying the function to the second elements of
|
|
821
|
+
* each array, and so on.
|
|
822
|
+
*
|
|
823
|
+
* Calling this function with arrays of different sizes will cause the returned
|
|
824
|
+
* array to have the length of the smaller array.
|
|
825
|
+
*
|
|
826
|
+
* @param fn: The function to apply to pairs of elements
|
|
827
|
+
* @param array1: The array whose elements will each be passed to the function as the first argument
|
|
828
|
+
* @param array2: The array whose elements will each be passed to the function as the second argument
|
|
829
|
+
* @returns The new array containing elements derived from applying the function to pairs of input array elements
|
|
830
|
+
*
|
|
831
|
+
* @example Array.zipWith((a, b) => a + b, [> 1, 2, 3], [> 4, 5, 6]) // [> 5, 7, 9]
|
|
832
|
+
* @example Array.zipWith((a, b) => a * b, [> 1, 2, 3], [> 4, 5]) // [> 4, 10]
|
|
833
|
+
*
|
|
834
|
+
* @since v0.5.3
|
|
835
|
+
*/
|
|
836
|
+
export let zipWith = (fn, array1: Array<a>, array2: Array<b>) => {
|
|
837
|
+
let len1 = length(array1)
|
|
838
|
+
let len2 = length(array2)
|
|
839
|
+
let minLen = if (len1 > len2) len2 else len1
|
|
840
|
+
init(minLen, index => {
|
|
841
|
+
fn(array1[index], array2[index])
|
|
842
|
+
})
|
|
843
|
+
}
|
|
844
|
+
|
|
790
845
|
/**
|
|
791
846
|
* Produces two arrays by splitting apart an array of tuples.
|
|
792
847
|
*
|
package/array.md
CHANGED
|
@@ -439,6 +439,45 @@ Examples:
|
|
|
439
439
|
Array.reduce((a, b) => a + b, 0, [> 1, 2, 3]) // 6
|
|
440
440
|
```
|
|
441
441
|
|
|
442
|
+
### Array.**reduceRight**
|
|
443
|
+
|
|
444
|
+
<details disabled>
|
|
445
|
+
<summary tabindex="-1">Added in <code>0.5.3</code></summary>
|
|
446
|
+
No other changes yet.
|
|
447
|
+
</details>
|
|
448
|
+
|
|
449
|
+
```grain
|
|
450
|
+
reduceRight : (((a, b) -> b), b, Array<a>) -> b
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Combines all elements of an array using a reducer function,
|
|
454
|
+
starting from the "end", or right side, of the array.
|
|
455
|
+
|
|
456
|
+
In `Array.reduceRight(fn, initial, array)`, `fn` is called with
|
|
457
|
+
each element of the array and an accumulator, and returns
|
|
458
|
+
a new accumulator. The final value is the last accumulator
|
|
459
|
+
returned. The accumulator starts with value `initial`.
|
|
460
|
+
|
|
461
|
+
Parameters:
|
|
462
|
+
|
|
463
|
+
|param|type|description|
|
|
464
|
+
|-----|----|-----------|
|
|
465
|
+
|`fn`|`(a, b) -> b`|The reducer function to call on each element, where the value returned will be the next accumulator value|
|
|
466
|
+
|`initial`|`b`|The initial value to use for the accumulator on the first iteration|
|
|
467
|
+
|`array`|`Array<a>`|The array to iterate|
|
|
468
|
+
|
|
469
|
+
Returns:
|
|
470
|
+
|
|
471
|
+
|type|description|
|
|
472
|
+
|----|-----------|
|
|
473
|
+
|`b`|The final accumulator returned from `fn`|
|
|
474
|
+
|
|
475
|
+
Examples:
|
|
476
|
+
|
|
477
|
+
```grain
|
|
478
|
+
Array.reduceRight((a, b) => b ++ a, "", [> "baz", "bar", "foo"]) // "foobarbaz"
|
|
479
|
+
```
|
|
480
|
+
|
|
442
481
|
### Array.**reducei**
|
|
443
482
|
|
|
444
483
|
<details disabled>
|
|
@@ -945,6 +984,50 @@ Returns:
|
|
|
945
984
|
|----|-----------|
|
|
946
985
|
|`Array<(a, b)>`|The new array containing indexed pairs of `(a, b)`|
|
|
947
986
|
|
|
987
|
+
### Array.**zipWith**
|
|
988
|
+
|
|
989
|
+
<details disabled>
|
|
990
|
+
<summary tabindex="-1">Added in <code>0.5.3</code></summary>
|
|
991
|
+
No other changes yet.
|
|
992
|
+
</details>
|
|
993
|
+
|
|
994
|
+
```grain
|
|
995
|
+
zipWith : (((a, b) -> c), Array<a>, Array<b>) -> Array<c>
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
Produces a new array filled with elements defined by applying a function on
|
|
999
|
+
pairs from both given arrays. The first element will contain the result of
|
|
1000
|
+
applying the function to the first elements of each array, the second element
|
|
1001
|
+
will contain the result of applying the function to the second elements of
|
|
1002
|
+
each array, and so on.
|
|
1003
|
+
|
|
1004
|
+
Calling this function with arrays of different sizes will cause the returned
|
|
1005
|
+
array to have the length of the smaller array.
|
|
1006
|
+
|
|
1007
|
+
Parameters:
|
|
1008
|
+
|
|
1009
|
+
|param|type|description|
|
|
1010
|
+
|-----|----|-----------|
|
|
1011
|
+
|`fn`|`(a, b) -> c`|The function to apply to pairs of elements|
|
|
1012
|
+
|`array1`|`Array<a>`|The array whose elements will each be passed to the function as the first argument|
|
|
1013
|
+
|`array2`|`Array<b>`|The array whose elements will each be passed to the function as the second argument|
|
|
1014
|
+
|
|
1015
|
+
Returns:
|
|
1016
|
+
|
|
1017
|
+
|type|description|
|
|
1018
|
+
|----|-----------|
|
|
1019
|
+
|`Array<c>`|The new array containing elements derived from applying the function to pairs of input array elements|
|
|
1020
|
+
|
|
1021
|
+
Examples:
|
|
1022
|
+
|
|
1023
|
+
```grain
|
|
1024
|
+
Array.zipWith((a, b) => a + b, [> 1, 2, 3], [> 4, 5, 6]) // [> 5, 7, 9]
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
```grain
|
|
1028
|
+
Array.zipWith((a, b) => a * b, [> 1, 2, 3], [> 4, 5]) // [> 4, 10]
|
|
1029
|
+
```
|
|
1030
|
+
|
|
948
1031
|
### Array.**unzip**
|
|
949
1032
|
|
|
950
1033
|
<details disabled>
|
package/bigint.md
CHANGED
|
@@ -5,7 +5,7 @@ title: BigInt
|
|
|
5
5
|
Utilities for working with the BigInt type.
|
|
6
6
|
|
|
7
7
|
<details disabled>
|
|
8
|
-
<summary tabindex="-1">Added in <code>
|
|
8
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
9
9
|
No other changes yet.
|
|
10
10
|
</details>
|
|
11
11
|
|
|
@@ -17,10 +17,10 @@ import BigInt from "bigint"
|
|
|
17
17
|
|
|
18
18
|
Functions for converting between Numbers and the BigInt type.
|
|
19
19
|
|
|
20
|
-
###
|
|
20
|
+
### BigInt.**fromNumber**
|
|
21
21
|
|
|
22
22
|
<details disabled>
|
|
23
|
-
<summary tabindex="-1">Added in <code>
|
|
23
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
24
24
|
No other changes yet.
|
|
25
25
|
</details>
|
|
26
26
|
|
|
@@ -42,10 +42,10 @@ Returns:
|
|
|
42
42
|
|----|-----------|
|
|
43
43
|
|`BigInt`|The Number represented as a BigInt|
|
|
44
44
|
|
|
45
|
-
###
|
|
45
|
+
### BigInt.**toNumber**
|
|
46
46
|
|
|
47
47
|
<details disabled>
|
|
48
|
-
<summary tabindex="-1">Added in <code>
|
|
48
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
49
49
|
No other changes yet.
|
|
50
50
|
</details>
|
|
51
51
|
|
|
@@ -71,10 +71,10 @@ Returns:
|
|
|
71
71
|
|
|
72
72
|
Mathematical operations for BigInt values.
|
|
73
73
|
|
|
74
|
-
###
|
|
74
|
+
### BigInt.**incr**
|
|
75
75
|
|
|
76
76
|
<details disabled>
|
|
77
|
-
<summary tabindex="-1">Added in <code>
|
|
77
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
78
78
|
No other changes yet.
|
|
79
79
|
</details>
|
|
80
80
|
|
|
@@ -96,10 +96,10 @@ Returns:
|
|
|
96
96
|
|----|-----------|
|
|
97
97
|
|`BigInt`|The incremented value|
|
|
98
98
|
|
|
99
|
-
###
|
|
99
|
+
### BigInt.**decr**
|
|
100
100
|
|
|
101
101
|
<details disabled>
|
|
102
|
-
<summary tabindex="-1">Added in <code>
|
|
102
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
103
103
|
No other changes yet.
|
|
104
104
|
</details>
|
|
105
105
|
|
|
@@ -121,10 +121,10 @@ Returns:
|
|
|
121
121
|
|----|-----------|
|
|
122
122
|
|`BigInt`|The decremented value|
|
|
123
123
|
|
|
124
|
-
###
|
|
124
|
+
### BigInt.**neg**
|
|
125
125
|
|
|
126
126
|
<details disabled>
|
|
127
|
-
<summary tabindex="-1">Added in <code>
|
|
127
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
128
128
|
No other changes yet.
|
|
129
129
|
</details>
|
|
130
130
|
|
|
@@ -146,10 +146,10 @@ Returns:
|
|
|
146
146
|
|----|-----------|
|
|
147
147
|
|`BigInt`|The negated operand|
|
|
148
148
|
|
|
149
|
-
###
|
|
149
|
+
### BigInt.**abs**
|
|
150
150
|
|
|
151
151
|
<details disabled>
|
|
152
|
-
<summary tabindex="-1">Added in <code>
|
|
152
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
153
153
|
No other changes yet.
|
|
154
154
|
</details>
|
|
155
155
|
|
|
@@ -171,10 +171,10 @@ Returns:
|
|
|
171
171
|
|----|-----------|
|
|
172
172
|
|`BigInt`|The operand's absolute value|
|
|
173
173
|
|
|
174
|
-
###
|
|
174
|
+
### BigInt.**add**
|
|
175
175
|
|
|
176
176
|
<details disabled>
|
|
177
|
-
<summary tabindex="-1">Added in <code>
|
|
177
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
178
178
|
No other changes yet.
|
|
179
179
|
</details>
|
|
180
180
|
|
|
@@ -197,10 +197,10 @@ Returns:
|
|
|
197
197
|
|----|-----------|
|
|
198
198
|
|`BigInt`|The sum of the two operands|
|
|
199
199
|
|
|
200
|
-
###
|
|
200
|
+
### BigInt.**sub**
|
|
201
201
|
|
|
202
202
|
<details disabled>
|
|
203
|
-
<summary tabindex="-1">Added in <code>
|
|
203
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
204
204
|
No other changes yet.
|
|
205
205
|
</details>
|
|
206
206
|
|
|
@@ -223,10 +223,10 @@ Returns:
|
|
|
223
223
|
|----|-----------|
|
|
224
224
|
|`BigInt`|The difference of the two operands|
|
|
225
225
|
|
|
226
|
-
###
|
|
226
|
+
### BigInt.**mul**
|
|
227
227
|
|
|
228
228
|
<details disabled>
|
|
229
|
-
<summary tabindex="-1">Added in <code>
|
|
229
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
230
230
|
No other changes yet.
|
|
231
231
|
</details>
|
|
232
232
|
|
|
@@ -249,10 +249,10 @@ Returns:
|
|
|
249
249
|
|----|-----------|
|
|
250
250
|
|`BigInt`|The product of the two operands|
|
|
251
251
|
|
|
252
|
-
###
|
|
252
|
+
### BigInt.**div**
|
|
253
253
|
|
|
254
254
|
<details disabled>
|
|
255
|
-
<summary tabindex="-1">Added in <code>
|
|
255
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
256
256
|
No other changes yet.
|
|
257
257
|
</details>
|
|
258
258
|
|
|
@@ -276,10 +276,10 @@ Returns:
|
|
|
276
276
|
|----|-----------|
|
|
277
277
|
|`BigInt`|The quotient of its operands|
|
|
278
278
|
|
|
279
|
-
###
|
|
279
|
+
### BigInt.**rem**
|
|
280
280
|
|
|
281
281
|
<details disabled>
|
|
282
|
-
<summary tabindex="-1">Added in <code>
|
|
282
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
283
283
|
No other changes yet.
|
|
284
284
|
</details>
|
|
285
285
|
|
|
@@ -303,10 +303,10 @@ Returns:
|
|
|
303
303
|
|----|-----------|
|
|
304
304
|
|`BigInt`|The remainder of its operands|
|
|
305
305
|
|
|
306
|
-
###
|
|
306
|
+
### BigInt.**quotRem**
|
|
307
307
|
|
|
308
308
|
<details disabled>
|
|
309
|
-
<summary tabindex="-1">Added in <code>
|
|
309
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
310
310
|
No other changes yet.
|
|
311
311
|
</details>
|
|
312
312
|
|
|
@@ -329,10 +329,10 @@ Returns:
|
|
|
329
329
|
|----|-----------|
|
|
330
330
|
|`(BigInt, BigInt)`|The quotient and remainder of its operands|
|
|
331
331
|
|
|
332
|
-
###
|
|
332
|
+
### BigInt.**gcd**
|
|
333
333
|
|
|
334
334
|
<details disabled>
|
|
335
|
-
<summary tabindex="-1">Added in <code>
|
|
335
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
336
336
|
No other changes yet.
|
|
337
337
|
</details>
|
|
338
338
|
|
|
@@ -359,10 +359,10 @@ Returns:
|
|
|
359
359
|
|
|
360
360
|
Functions for operating on bits of BigInt values.
|
|
361
361
|
|
|
362
|
-
###
|
|
362
|
+
### BigInt.**shl**
|
|
363
363
|
|
|
364
364
|
<details disabled>
|
|
365
|
-
<summary tabindex="-1">Added in <code>
|
|
365
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
366
366
|
No other changes yet.
|
|
367
367
|
</details>
|
|
368
368
|
|
|
@@ -385,10 +385,10 @@ Returns:
|
|
|
385
385
|
|----|-----------|
|
|
386
386
|
|`BigInt`|The shifted value|
|
|
387
387
|
|
|
388
|
-
###
|
|
388
|
+
### BigInt.**shr**
|
|
389
389
|
|
|
390
390
|
<details disabled>
|
|
391
|
-
<summary tabindex="-1">Added in <code>
|
|
391
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
392
392
|
No other changes yet.
|
|
393
393
|
</details>
|
|
394
394
|
|
|
@@ -415,10 +415,10 @@ Returns:
|
|
|
415
415
|
|
|
416
416
|
Functions for comparing BigInt values.
|
|
417
417
|
|
|
418
|
-
###
|
|
418
|
+
### BigInt.**eqz**
|
|
419
419
|
|
|
420
420
|
<details disabled>
|
|
421
|
-
<summary tabindex="-1">Added in <code>
|
|
421
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
422
422
|
No other changes yet.
|
|
423
423
|
</details>
|
|
424
424
|
|
|
@@ -440,10 +440,10 @@ Returns:
|
|
|
440
440
|
|----|-----------|
|
|
441
441
|
|`Bool`|`true` if the first value is equal to zero or `false` otherwise|
|
|
442
442
|
|
|
443
|
-
###
|
|
443
|
+
### BigInt.**eq**
|
|
444
444
|
|
|
445
445
|
<details disabled>
|
|
446
|
-
<summary tabindex="-1">Added in <code>
|
|
446
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
447
447
|
No other changes yet.
|
|
448
448
|
</details>
|
|
449
449
|
|
|
@@ -466,10 +466,10 @@ Returns:
|
|
|
466
466
|
|----|-----------|
|
|
467
467
|
|`Bool`|`true` if the first value is equal to the second value or `false` otherwise|
|
|
468
468
|
|
|
469
|
-
###
|
|
469
|
+
### BigInt.**ne**
|
|
470
470
|
|
|
471
471
|
<details disabled>
|
|
472
|
-
<summary tabindex="-1">Added in <code>
|
|
472
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
473
473
|
No other changes yet.
|
|
474
474
|
</details>
|
|
475
475
|
|
|
@@ -492,10 +492,10 @@ Returns:
|
|
|
492
492
|
|----|-----------|
|
|
493
493
|
|`Bool`|`true` if the first value is not equal to the second value or `false` otherwise|
|
|
494
494
|
|
|
495
|
-
###
|
|
495
|
+
### BigInt.**lt**
|
|
496
496
|
|
|
497
497
|
<details disabled>
|
|
498
|
-
<summary tabindex="-1">Added in <code>
|
|
498
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
499
499
|
No other changes yet.
|
|
500
500
|
</details>
|
|
501
501
|
|
|
@@ -518,10 +518,10 @@ Returns:
|
|
|
518
518
|
|----|-----------|
|
|
519
519
|
|`Bool`|`true` if the first value is less than the second value or `false` otherwise|
|
|
520
520
|
|
|
521
|
-
###
|
|
521
|
+
### BigInt.**lte**
|
|
522
522
|
|
|
523
523
|
<details disabled>
|
|
524
|
-
<summary tabindex="-1">Added in <code>
|
|
524
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
525
525
|
No other changes yet.
|
|
526
526
|
</details>
|
|
527
527
|
|
|
@@ -544,10 +544,10 @@ Returns:
|
|
|
544
544
|
|----|-----------|
|
|
545
545
|
|`Bool`|`true` if the first value is less than or equal to the second value or `false` otherwise|
|
|
546
546
|
|
|
547
|
-
###
|
|
547
|
+
### BigInt.**gt**
|
|
548
548
|
|
|
549
549
|
<details disabled>
|
|
550
|
-
<summary tabindex="-1">Added in <code>
|
|
550
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
551
551
|
No other changes yet.
|
|
552
552
|
</details>
|
|
553
553
|
|
|
@@ -570,10 +570,10 @@ Returns:
|
|
|
570
570
|
|----|-----------|
|
|
571
571
|
|`Bool`|`true` if the first value is greater than the second value or `false` otherwise|
|
|
572
572
|
|
|
573
|
-
###
|
|
573
|
+
### BigInt.**gte**
|
|
574
574
|
|
|
575
575
|
<details disabled>
|
|
576
|
-
<summary tabindex="-1">Added in <code>
|
|
576
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
577
577
|
No other changes yet.
|
|
578
578
|
</details>
|
|
579
579
|
|
|
@@ -600,10 +600,10 @@ Returns:
|
|
|
600
600
|
|
|
601
601
|
Boolean operations on the bits of BigInt values.
|
|
602
602
|
|
|
603
|
-
###
|
|
603
|
+
### BigInt.**lnot**
|
|
604
604
|
|
|
605
605
|
<details disabled>
|
|
606
|
-
<summary tabindex="-1">Added in <code>
|
|
606
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
607
607
|
No other changes yet.
|
|
608
608
|
</details>
|
|
609
609
|
|
|
@@ -625,10 +625,10 @@ Returns:
|
|
|
625
625
|
|----|-----------|
|
|
626
626
|
|`BigInt`|Containing the inverted bits of the given value|
|
|
627
627
|
|
|
628
|
-
###
|
|
628
|
+
### BigInt.**land**
|
|
629
629
|
|
|
630
630
|
<details disabled>
|
|
631
|
-
<summary tabindex="-1">Added in <code>
|
|
631
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
632
632
|
No other changes yet.
|
|
633
633
|
</details>
|
|
634
634
|
|
|
@@ -651,10 +651,10 @@ Returns:
|
|
|
651
651
|
|----|-----------|
|
|
652
652
|
|`BigInt`|Containing a `1` in each bit position for which the corresponding bits of both operands are `1`|
|
|
653
653
|
|
|
654
|
-
###
|
|
654
|
+
### BigInt.**lor**
|
|
655
655
|
|
|
656
656
|
<details disabled>
|
|
657
|
-
<summary tabindex="-1">Added in <code>
|
|
657
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
658
658
|
No other changes yet.
|
|
659
659
|
</details>
|
|
660
660
|
|
|
@@ -677,10 +677,10 @@ Returns:
|
|
|
677
677
|
|----|-----------|
|
|
678
678
|
|`BigInt`|Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1`|
|
|
679
679
|
|
|
680
|
-
###
|
|
680
|
+
### BigInt.**lxor**
|
|
681
681
|
|
|
682
682
|
<details disabled>
|
|
683
|
-
<summary tabindex="-1">Added in <code>
|
|
683
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
684
684
|
No other changes yet.
|
|
685
685
|
</details>
|
|
686
686
|
|
|
@@ -703,10 +703,10 @@ Returns:
|
|
|
703
703
|
|----|-----------|
|
|
704
704
|
|`BigInt`|Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1`|
|
|
705
705
|
|
|
706
|
-
###
|
|
706
|
+
### BigInt.**clz**
|
|
707
707
|
|
|
708
708
|
<details disabled>
|
|
709
|
-
<summary tabindex="-1">Added in <code>
|
|
709
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
710
710
|
No other changes yet.
|
|
711
711
|
</details>
|
|
712
712
|
|
|
@@ -729,10 +729,10 @@ Returns:
|
|
|
729
729
|
|----|-----------|
|
|
730
730
|
|`Int32`|The amount of leading zeros|
|
|
731
731
|
|
|
732
|
-
###
|
|
732
|
+
### BigInt.**ctz**
|
|
733
733
|
|
|
734
734
|
<details disabled>
|
|
735
|
-
<summary tabindex="-1">Added in <code>
|
|
735
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
736
736
|
No other changes yet.
|
|
737
737
|
</details>
|
|
738
738
|
|
|
@@ -754,10 +754,10 @@ Returns:
|
|
|
754
754
|
|----|-----------|
|
|
755
755
|
|`Int64`|The amount of trailing zeros|
|
|
756
756
|
|
|
757
|
-
###
|
|
757
|
+
### BigInt.**popcnt**
|
|
758
758
|
|
|
759
759
|
<details disabled>
|
|
760
|
-
<summary tabindex="-1">Added in <code>
|
|
760
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
761
761
|
No other changes yet.
|
|
762
762
|
</details>
|
|
763
763
|
|
|
@@ -784,10 +784,10 @@ Returns:
|
|
|
784
784
|
|
|
785
785
|
Other functions on BigInts.
|
|
786
786
|
|
|
787
|
-
###
|
|
787
|
+
### BigInt.**toString**
|
|
788
788
|
|
|
789
789
|
<details disabled>
|
|
790
|
-
<summary tabindex="-1">Added in <code>
|
|
790
|
+
<summary tabindex="-1">Added in <code>0.5.0</code></summary>
|
|
791
791
|
No other changes yet.
|
|
792
792
|
</details>
|
|
793
793
|
|