@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/uint16.md
CHANGED
|
@@ -40,15 +40,15 @@ Converts a Number to a Uint16.
|
|
|
40
40
|
|
|
41
41
|
Parameters:
|
|
42
42
|
|
|
43
|
-
|param|type|description|
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
| param | type | description |
|
|
44
|
+
| -------- | -------- | -------------------- |
|
|
45
|
+
| `number` | `Number` | The value to convert |
|
|
46
46
|
|
|
47
47
|
Returns:
|
|
48
48
|
|
|
49
|
-
|type|description|
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
| type | description |
|
|
50
|
+
| -------- | ---------------------------------- |
|
|
51
|
+
| `Uint16` | The Number represented as a Uint16 |
|
|
52
52
|
|
|
53
53
|
### Uint16.**toNumber**
|
|
54
54
|
|
|
@@ -65,15 +65,15 @@ Converts a Uint16 to a Number.
|
|
|
65
65
|
|
|
66
66
|
Parameters:
|
|
67
67
|
|
|
68
|
-
|param|type|description|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
| param | type | description |
|
|
69
|
+
| ------- | -------- | -------------------- |
|
|
70
|
+
| `value` | `Uint16` | The value to convert |
|
|
71
71
|
|
|
72
72
|
Returns:
|
|
73
73
|
|
|
74
|
-
|type|description|
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
| type | description |
|
|
75
|
+
| -------- | ---------------------------------- |
|
|
76
|
+
| `Number` | The Uint16 represented as a Number |
|
|
77
77
|
|
|
78
78
|
### Uint16.**fromInt16**
|
|
79
79
|
|
|
@@ -90,15 +90,15 @@ Converts an Int16 to a Uint16.
|
|
|
90
90
|
|
|
91
91
|
Parameters:
|
|
92
92
|
|
|
93
|
-
|param|type|description|
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
| param | type | description |
|
|
94
|
+
| -------- | ------- | -------------------- |
|
|
95
|
+
| `number` | `Int16` | The value to convert |
|
|
96
96
|
|
|
97
97
|
Returns:
|
|
98
98
|
|
|
99
|
-
|type|description|
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
| type | description |
|
|
100
|
+
| -------- | --------------------------------- |
|
|
101
|
+
| `Uint16` | The Int16 represented as a Uint16 |
|
|
102
102
|
|
|
103
103
|
Examples:
|
|
104
104
|
|
|
@@ -125,15 +125,15 @@ Increments the value by one.
|
|
|
125
125
|
|
|
126
126
|
Parameters:
|
|
127
127
|
|
|
128
|
-
|param|type|description|
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
| param | type | description |
|
|
129
|
+
| ------- | -------- | ---------------------- |
|
|
130
|
+
| `value` | `Uint16` | The value to increment |
|
|
131
131
|
|
|
132
132
|
Returns:
|
|
133
133
|
|
|
134
|
-
|type|description|
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
| type | description |
|
|
135
|
+
| -------- | --------------------- |
|
|
136
|
+
| `Uint16` | The incremented value |
|
|
137
137
|
|
|
138
138
|
Examples:
|
|
139
139
|
|
|
@@ -156,15 +156,15 @@ Decrements the value by one.
|
|
|
156
156
|
|
|
157
157
|
Parameters:
|
|
158
158
|
|
|
159
|
-
|param|type|description|
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
| param | type | description |
|
|
160
|
+
| ------- | -------- | ---------------------- |
|
|
161
|
+
| `value` | `Uint16` | The value to decrement |
|
|
162
162
|
|
|
163
163
|
Returns:
|
|
164
164
|
|
|
165
|
-
|type|description|
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
| type | description |
|
|
166
|
+
| -------- | --------------------- |
|
|
167
|
+
| `Uint16` | The decremented value |
|
|
168
168
|
|
|
169
169
|
Examples:
|
|
170
170
|
|
|
@@ -191,16 +191,16 @@ Computes the sum of its operands.
|
|
|
191
191
|
|
|
192
192
|
Parameters:
|
|
193
193
|
|
|
194
|
-
|param|type|description|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
| param | type | description |
|
|
195
|
+
| ----- | -------- | ------------------ |
|
|
196
|
+
| `x` | `Uint16` | The first operand |
|
|
197
|
+
| `y` | `Uint16` | The second operand |
|
|
198
198
|
|
|
199
199
|
Returns:
|
|
200
200
|
|
|
201
|
-
|type|description|
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
| type | description |
|
|
202
|
+
| -------- | --------------------------- |
|
|
203
|
+
| `Uint16` | The sum of the two operands |
|
|
204
204
|
|
|
205
205
|
Examples:
|
|
206
206
|
|
|
@@ -224,16 +224,16 @@ Computes the difference of its operands.
|
|
|
224
224
|
|
|
225
225
|
Parameters:
|
|
226
226
|
|
|
227
|
-
|param|type|description|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
| param | type | description |
|
|
228
|
+
| ----- | -------- | ------------------ |
|
|
229
|
+
| `x` | `Uint16` | The first operand |
|
|
230
|
+
| `y` | `Uint16` | The second operand |
|
|
231
231
|
|
|
232
232
|
Returns:
|
|
233
233
|
|
|
234
|
-
|type|description|
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
| type | description |
|
|
235
|
+
| -------- | ---------------------------------- |
|
|
236
|
+
| `Uint16` | The difference of the two operands |
|
|
237
237
|
|
|
238
238
|
Examples:
|
|
239
239
|
|
|
@@ -257,16 +257,16 @@ Computes the product of its operands.
|
|
|
257
257
|
|
|
258
258
|
Parameters:
|
|
259
259
|
|
|
260
|
-
|param|type|description|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
| param | type | description |
|
|
261
|
+
| ----- | -------- | ------------------ |
|
|
262
|
+
| `x` | `Uint16` | The first operand |
|
|
263
|
+
| `y` | `Uint16` | The second operand |
|
|
264
264
|
|
|
265
265
|
Returns:
|
|
266
266
|
|
|
267
|
-
|type|description|
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
| type | description |
|
|
268
|
+
| -------- | ------------------------------- |
|
|
269
|
+
| `Uint16` | The product of the two operands |
|
|
270
270
|
|
|
271
271
|
Examples:
|
|
272
272
|
|
|
@@ -290,16 +290,16 @@ Computes the quotient of its operands.
|
|
|
290
290
|
|
|
291
291
|
Parameters:
|
|
292
292
|
|
|
293
|
-
|param|type|description|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
293
|
+
| param | type | description |
|
|
294
|
+
| ----- | -------- | ------------------ |
|
|
295
|
+
| `x` | `Uint16` | The first operand |
|
|
296
|
+
| `y` | `Uint16` | The second operand |
|
|
297
297
|
|
|
298
298
|
Returns:
|
|
299
299
|
|
|
300
|
-
|type|description|
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
| type | description |
|
|
301
|
+
| -------- | ---------------------------- |
|
|
302
|
+
| `Uint16` | The quotient of its operands |
|
|
303
303
|
|
|
304
304
|
Examples:
|
|
305
305
|
|
|
@@ -323,16 +323,16 @@ Computes the remainder of the division of its operands.
|
|
|
323
323
|
|
|
324
324
|
Parameters:
|
|
325
325
|
|
|
326
|
-
|param|type|description|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
326
|
+
| param | type | description |
|
|
327
|
+
| ----- | -------- | ------------------ |
|
|
328
|
+
| `x` | `Uint16` | The first operand |
|
|
329
|
+
| `y` | `Uint16` | The second operand |
|
|
330
330
|
|
|
331
331
|
Returns:
|
|
332
332
|
|
|
333
|
-
|type|description|
|
|
334
|
-
|
|
335
|
-
|
|
333
|
+
| type | description |
|
|
334
|
+
| -------- | ----------------------------- |
|
|
335
|
+
| `Uint16` | The remainder of its operands |
|
|
336
336
|
|
|
337
337
|
Examples:
|
|
338
338
|
|
|
@@ -355,16 +355,16 @@ Shifts the bits of the value left by the given number of bits.
|
|
|
355
355
|
|
|
356
356
|
Parameters:
|
|
357
357
|
|
|
358
|
-
|param|type|description|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
358
|
+
| param | type | description |
|
|
359
|
+
| -------- | -------- | ------------------------------ |
|
|
360
|
+
| `value` | `Uint16` | The value to shift |
|
|
361
|
+
| `amount` | `Uint16` | The number of bits to shift by |
|
|
362
362
|
|
|
363
363
|
Returns:
|
|
364
364
|
|
|
365
|
-
|type|description|
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
| type | description |
|
|
366
|
+
| -------- | ----------------- |
|
|
367
|
+
| `Uint16` | The shifted value |
|
|
368
368
|
|
|
369
369
|
Examples:
|
|
370
370
|
|
|
@@ -388,16 +388,16 @@ Shifts the bits of the value right by the given number of bits.
|
|
|
388
388
|
|
|
389
389
|
Parameters:
|
|
390
390
|
|
|
391
|
-
|param|type|description|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
391
|
+
| param | type | description |
|
|
392
|
+
| -------- | -------- | ---------------------- |
|
|
393
|
+
| `value` | `Uint16` | The value to shift |
|
|
394
|
+
| `amount` | `Uint16` | The amount to shift by |
|
|
395
395
|
|
|
396
396
|
Returns:
|
|
397
397
|
|
|
398
|
-
|type|description|
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
| type | description |
|
|
399
|
+
| -------- | ----------------- |
|
|
400
|
+
| `Uint16` | The shifted value |
|
|
401
401
|
|
|
402
402
|
Examples:
|
|
403
403
|
|
|
@@ -421,16 +421,16 @@ Checks if the first value is equal to the second value.
|
|
|
421
421
|
|
|
422
422
|
Parameters:
|
|
423
423
|
|
|
424
|
-
|param|type|description|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
424
|
+
| param | type | description |
|
|
425
|
+
| ----- | -------- | ---------------- |
|
|
426
|
+
| `x` | `Uint16` | The first value |
|
|
427
|
+
| `y` | `Uint16` | The second value |
|
|
428
428
|
|
|
429
429
|
Returns:
|
|
430
430
|
|
|
431
|
-
|type|description|
|
|
432
|
-
|
|
433
|
-
|
|
431
|
+
| type | description |
|
|
432
|
+
| ------ | --------------------------------------------------------------------------- |
|
|
433
|
+
| `Bool` | `true` if the first value is equal to the second value or `false` otherwise |
|
|
434
434
|
|
|
435
435
|
Examples:
|
|
436
436
|
|
|
@@ -454,16 +454,16 @@ Checks if the first value is not equal to the second value.
|
|
|
454
454
|
|
|
455
455
|
Parameters:
|
|
456
456
|
|
|
457
|
-
|param|type|description|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
457
|
+
| param | type | description |
|
|
458
|
+
| ----- | -------- | ---------------- |
|
|
459
|
+
| `x` | `Uint16` | The first value |
|
|
460
|
+
| `y` | `Uint16` | The second value |
|
|
461
461
|
|
|
462
462
|
Returns:
|
|
463
463
|
|
|
464
|
-
|type|description|
|
|
465
|
-
|
|
466
|
-
|
|
464
|
+
| type | description |
|
|
465
|
+
| ------ | ------------------------------------------------------------------------------- |
|
|
466
|
+
| `Bool` | `true` if the first value is not equal to the second value or `false` otherwise |
|
|
467
467
|
|
|
468
468
|
Examples:
|
|
469
469
|
|
|
@@ -487,16 +487,16 @@ Checks if the first value is less than the second value.
|
|
|
487
487
|
|
|
488
488
|
Parameters:
|
|
489
489
|
|
|
490
|
-
|param|type|description|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
490
|
+
| param | type | description |
|
|
491
|
+
| ----- | -------- | ---------------- |
|
|
492
|
+
| `x` | `Uint16` | The first value |
|
|
493
|
+
| `y` | `Uint16` | The second value |
|
|
494
494
|
|
|
495
495
|
Returns:
|
|
496
496
|
|
|
497
|
-
|type|description|
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
| type | description |
|
|
498
|
+
| ------ | ---------------------------------------------------------------------------- |
|
|
499
|
+
| `Bool` | `true` if the first value is less than the second value or `false` otherwise |
|
|
500
500
|
|
|
501
501
|
Examples:
|
|
502
502
|
|
|
@@ -520,16 +520,16 @@ Checks if the first value is greater than the second value.
|
|
|
520
520
|
|
|
521
521
|
Parameters:
|
|
522
522
|
|
|
523
|
-
|param|type|description|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
523
|
+
| param | type | description |
|
|
524
|
+
| ----- | -------- | ---------------- |
|
|
525
|
+
| `x` | `Uint16` | The first value |
|
|
526
|
+
| `y` | `Uint16` | The second value |
|
|
527
527
|
|
|
528
528
|
Returns:
|
|
529
529
|
|
|
530
|
-
|type|description|
|
|
531
|
-
|
|
532
|
-
|
|
530
|
+
| type | description |
|
|
531
|
+
| ------ | ------------------------------------------------------------------------------- |
|
|
532
|
+
| `Bool` | `true` if the first value is greater than the second value or `false` otherwise |
|
|
533
533
|
|
|
534
534
|
Examples:
|
|
535
535
|
|
|
@@ -553,16 +553,16 @@ Checks if the first value is less than or equal to the second value.
|
|
|
553
553
|
|
|
554
554
|
Parameters:
|
|
555
555
|
|
|
556
|
-
|param|type|description|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
556
|
+
| param | type | description |
|
|
557
|
+
| ----- | -------- | ---------------- |
|
|
558
|
+
| `x` | `Uint16` | The first value |
|
|
559
|
+
| `y` | `Uint16` | The second value |
|
|
560
560
|
|
|
561
561
|
Returns:
|
|
562
562
|
|
|
563
|
-
|type|description|
|
|
564
|
-
|
|
565
|
-
|
|
563
|
+
| type | description |
|
|
564
|
+
| ------ | ---------------------------------------------------------------------------------------- |
|
|
565
|
+
| `Bool` | `true` if the first value is less than or equal to the second value or `false` otherwise |
|
|
566
566
|
|
|
567
567
|
Examples:
|
|
568
568
|
|
|
@@ -591,16 +591,16 @@ Checks if the first value is greater than or equal to the second value.
|
|
|
591
591
|
|
|
592
592
|
Parameters:
|
|
593
593
|
|
|
594
|
-
|param|type|description|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
594
|
+
| param | type | description |
|
|
595
|
+
| ----- | -------- | ---------------- |
|
|
596
|
+
| `x` | `Uint16` | The first value |
|
|
597
|
+
| `y` | `Uint16` | The second value |
|
|
598
598
|
|
|
599
599
|
Returns:
|
|
600
600
|
|
|
601
|
-
|type|description|
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
| type | description |
|
|
602
|
+
| ------ | ------------------------------------------------------------------------------------------- |
|
|
603
|
+
| `Bool` | `true` if the first value is greater than or equal to the second value or `false` otherwise |
|
|
604
604
|
|
|
605
605
|
Examples:
|
|
606
606
|
|
|
@@ -629,15 +629,15 @@ Computes the bitwise NOT of the given value.
|
|
|
629
629
|
|
|
630
630
|
Parameters:
|
|
631
631
|
|
|
632
|
-
|param|type|description|
|
|
633
|
-
|
|
634
|
-
|
|
632
|
+
| param | type | description |
|
|
633
|
+
| ------- | -------- | --------------- |
|
|
634
|
+
| `value` | `Uint16` | The given value |
|
|
635
635
|
|
|
636
636
|
Returns:
|
|
637
637
|
|
|
638
|
-
|type|description|
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
| type | description |
|
|
639
|
+
| -------- | ----------------------------------------------- |
|
|
640
|
+
| `Uint16` | Containing the inverted bits of the given value |
|
|
641
641
|
|
|
642
642
|
Examples:
|
|
643
643
|
|
|
@@ -660,16 +660,16 @@ Computes the bitwise AND (`&`) on the given operands.
|
|
|
660
660
|
|
|
661
661
|
Parameters:
|
|
662
662
|
|
|
663
|
-
|param|type|description|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
663
|
+
| param | type | description |
|
|
664
|
+
| ----- | -------- | ------------------ |
|
|
665
|
+
| `x` | `Uint16` | The first operand |
|
|
666
|
+
| `y` | `Uint16` | The second operand |
|
|
667
667
|
|
|
668
668
|
Returns:
|
|
669
669
|
|
|
670
|
-
|type|description|
|
|
671
|
-
|
|
672
|
-
|
|
670
|
+
| type | description |
|
|
671
|
+
| -------- | ----------------------------------------------------------------------------------------------- |
|
|
672
|
+
| `Uint16` | Containing a `1` in each bit position for which the corresponding bits of both operands are `1` |
|
|
673
673
|
|
|
674
674
|
Examples:
|
|
675
675
|
|
|
@@ -693,16 +693,16 @@ Computes the bitwise OR (`|`) on the given operands.
|
|
|
693
693
|
|
|
694
694
|
Parameters:
|
|
695
695
|
|
|
696
|
-
|param|type|description|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
696
|
+
| param | type | description |
|
|
697
|
+
| ----- | -------- | ------------------ |
|
|
698
|
+
| `x` | `Uint16` | The first operand |
|
|
699
|
+
| `y` | `Uint16` | The second operand |
|
|
700
700
|
|
|
701
701
|
Returns:
|
|
702
702
|
|
|
703
|
-
|type|description|
|
|
704
|
-
|
|
705
|
-
|
|
703
|
+
| type | description |
|
|
704
|
+
| -------- | --------------------------------------------------------------------------------------------------------- |
|
|
705
|
+
| `Uint16` | Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1` |
|
|
706
706
|
|
|
707
707
|
Examples:
|
|
708
708
|
|
|
@@ -726,16 +726,16 @@ Computes the bitwise XOR (`^`) on the given operands.
|
|
|
726
726
|
|
|
727
727
|
Parameters:
|
|
728
728
|
|
|
729
|
-
|param|type|description|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
729
|
+
| param | type | description |
|
|
730
|
+
| ----- | -------- | ------------------ |
|
|
731
|
+
| `x` | `Uint16` | The first operand |
|
|
732
|
+
| `y` | `Uint16` | The second operand |
|
|
733
733
|
|
|
734
734
|
Returns:
|
|
735
735
|
|
|
736
|
-
|type|description|
|
|
737
|
-
|
|
738
|
-
|
|
736
|
+
| type | description |
|
|
737
|
+
| -------- | -------------------------------------------------------------------------------------------------------------- |
|
|
738
|
+
| `Uint16` | Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1` |
|
|
739
739
|
|
|
740
740
|
Examples:
|
|
741
741
|
|