@grain/stdlib 0.6.6 → 0.7.1

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/LICENSE +1 -1
  3. package/README.md +2 -2
  4. package/array.gr +55 -7
  5. package/array.md +606 -560
  6. package/bigint.md +228 -228
  7. package/buffer.gr +85 -53
  8. package/buffer.md +442 -319
  9. package/bytes.gr +112 -35
  10. package/bytes.md +299 -219
  11. package/char.gr +201 -99
  12. package/char.md +447 -120
  13. package/exception.gr +11 -11
  14. package/exception.md +29 -4
  15. package/float32.gr +327 -3
  16. package/float32.md +698 -111
  17. package/float64.gr +320 -3
  18. package/float64.md +698 -111
  19. package/fs.gr +1082 -0
  20. package/fs.md +630 -0
  21. package/hash.gr +142 -88
  22. package/hash.md +105 -17
  23. package/int16.md +178 -178
  24. package/int32.gr +26 -5
  25. package/int32.md +266 -231
  26. package/int64.gr +27 -2
  27. package/int64.md +266 -231
  28. package/int8.md +178 -178
  29. package/json.gr +366 -51
  30. package/json.md +431 -15
  31. package/list.gr +328 -31
  32. package/list.md +759 -336
  33. package/map.gr +20 -12
  34. package/map.md +266 -260
  35. package/marshal.gr +41 -40
  36. package/marshal.md +14 -14
  37. package/number.gr +278 -35
  38. package/number.md +688 -269
  39. package/option.md +162 -162
  40. package/package.json +5 -3
  41. package/path.gr +48 -0
  42. package/path.md +180 -89
  43. package/pervasives.gr +2 -2
  44. package/pervasives.md +275 -275
  45. package/priorityqueue.gr +7 -7
  46. package/priorityqueue.md +131 -131
  47. package/queue.gr +183 -29
  48. package/queue.md +404 -148
  49. package/random.md +43 -43
  50. package/range.gr +4 -4
  51. package/range.md +42 -42
  52. package/rational.md +123 -123
  53. package/regex.gr +52 -51
  54. package/regex.md +102 -102
  55. package/result.md +118 -118
  56. package/runtime/atof/common.md +39 -39
  57. package/runtime/atof/decimal.gr +6 -6
  58. package/runtime/atof/decimal.md +14 -14
  59. package/runtime/atof/lemire.gr +5 -5
  60. package/runtime/atof/lemire.md +1 -1
  61. package/runtime/atof/parse.gr +16 -16
  62. package/runtime/atof/parse.md +2 -2
  63. package/runtime/atof/slow.md +1 -1
  64. package/runtime/atof/table.md +2 -2
  65. package/runtime/atoi/parse.gr +3 -3
  66. package/runtime/atoi/parse.md +1 -1
  67. package/runtime/bigint.gr +15 -47
  68. package/runtime/bigint.md +54 -60
  69. package/runtime/compare.gr +2 -2
  70. package/runtime/compare.md +8 -8
  71. package/runtime/dataStructures.md +211 -211
  72. package/runtime/debugPrint.gr +4 -1
  73. package/runtime/debugPrint.md +9 -9
  74. package/runtime/equal.gr +99 -77
  75. package/runtime/equal.md +8 -8
  76. package/runtime/exception.gr +62 -82
  77. package/runtime/exception.md +62 -11
  78. package/runtime/gc.gr +39 -45
  79. package/runtime/gc.md +4 -4
  80. package/runtime/malloc.gr +7 -7
  81. package/runtime/malloc.md +13 -13
  82. package/runtime/math/kernel/cos.gr +70 -0
  83. package/runtime/math/kernel/cos.md +14 -0
  84. package/runtime/math/kernel/sin.gr +65 -0
  85. package/runtime/math/kernel/sin.md +14 -0
  86. package/runtime/math/kernel/tan.gr +136 -0
  87. package/runtime/math/kernel/tan.md +14 -0
  88. package/runtime/math/rempio2.gr +244 -0
  89. package/runtime/math/rempio2.md +14 -0
  90. package/runtime/math/trig.gr +130 -0
  91. package/runtime/math/trig.md +28 -0
  92. package/runtime/math/umuldi.gr +26 -0
  93. package/runtime/math/umuldi.md +14 -0
  94. package/runtime/numberUtils.gr +29 -29
  95. package/runtime/numberUtils.md +12 -12
  96. package/runtime/numbers.gr +373 -381
  97. package/runtime/numbers.md +348 -342
  98. package/runtime/string.gr +37 -105
  99. package/runtime/string.md +20 -26
  100. package/runtime/unsafe/constants.md +24 -24
  101. package/runtime/unsafe/conv.md +19 -19
  102. package/runtime/unsafe/memory.gr +24 -20
  103. package/runtime/unsafe/memory.md +27 -7
  104. package/runtime/unsafe/offsets.gr +36 -0
  105. package/runtime/unsafe/offsets.md +88 -0
  106. package/runtime/unsafe/panic.gr +28 -0
  107. package/runtime/unsafe/panic.md +14 -0
  108. package/runtime/unsafe/tags.md +32 -32
  109. package/runtime/unsafe/wasmf32.md +28 -28
  110. package/runtime/unsafe/wasmf64.md +28 -28
  111. package/runtime/unsafe/wasmi32.md +47 -47
  112. package/runtime/unsafe/wasmi64.md +50 -50
  113. package/runtime/utf8.gr +189 -0
  114. package/runtime/utf8.md +117 -0
  115. package/runtime/wasi.gr +4 -2
  116. package/runtime/wasi.md +147 -147
  117. package/set.gr +18 -11
  118. package/set.md +253 -247
  119. package/stack.gr +171 -2
  120. package/stack.md +371 -89
  121. package/string.gr +352 -557
  122. package/string.md +298 -255
  123. package/uint16.md +170 -170
  124. package/uint32.gr +25 -4
  125. package/uint32.md +249 -214
  126. package/uint64.gr +25 -5
  127. package/uint64.md +249 -214
  128. package/uint8.md +170 -170
  129. package/uri.gr +57 -53
  130. package/uri.md +88 -89
  131. package/wasi/file.gr +67 -59
  132. package/wasi/file.md +308 -308
  133. package/wasi/process.md +26 -26
  134. package/wasi/random.md +12 -12
  135. package/wasi/time.md +16 -16
  136. package/runtime/utils/printing.gr +0 -60
  137. package/runtime/utils/printing.md +0 -26
package/rational.md CHANGED
@@ -33,22 +33,22 @@ No other changes yet.
33
33
  </details>
34
34
 
35
35
  ```grain
36
- fromNumber : (number: Number) => Rational
36
+ fromNumber: (number: Number) => Rational
37
37
  ```
38
38
 
39
39
  Converts a Number to a Rational.
40
40
 
41
41
  Parameters:
42
42
 
43
- |param|type|description|
44
- |-----|----|-----------|
45
- |`number`|`Number`|The value to convert|
43
+ | param | type | description |
44
+ | -------- | -------- | -------------------- |
45
+ | `number` | `Number` | The value to convert |
46
46
 
47
47
  Returns:
48
48
 
49
- |type|description|
50
- |----|-----------|
51
- |`Rational`|The Number represented as a Rational|
49
+ | type | description |
50
+ | ---------- | ------------------------------------ |
51
+ | `Rational` | The Number represented as a Rational |
52
52
 
53
53
  ### Rational.**toNumber**
54
54
 
@@ -58,22 +58,22 @@ No other changes yet.
58
58
  </details>
59
59
 
60
60
  ```grain
61
- toNumber : (rational: Rational) => Number
61
+ toNumber: (rational: Rational) => Number
62
62
  ```
63
63
 
64
64
  Converts a Rational to a Number.
65
65
 
66
66
  Parameters:
67
67
 
68
- |param|type|description|
69
- |-----|----|-----------|
70
- |`rational`|`Rational`|The value to convert|
68
+ | param | type | description |
69
+ | ---------- | ---------- | -------------------- |
70
+ | `rational` | `Rational` | The value to convert |
71
71
 
72
72
  Returns:
73
73
 
74
- |type|description|
75
- |----|-----------|
76
- |`Number`|The Rational represented as a Number|
74
+ | type | description |
75
+ | -------- | ------------------------------------ |
76
+ | `Number` | The Rational represented as a Number |
77
77
 
78
78
  ### Rational.**numerator**
79
79
 
@@ -83,22 +83,22 @@ No other changes yet.
83
83
  </details>
84
84
 
85
85
  ```grain
86
- numerator : (x: Rational) => Number
86
+ numerator: (x: Rational) => Number
87
87
  ```
88
88
 
89
89
  Finds the numerator of the rational number.
90
90
 
91
91
  Parameters:
92
92
 
93
- |param|type|description|
94
- |-----|----|-----------|
95
- |`x`|`Rational`|The rational number to inspect|
93
+ | param | type | description |
94
+ | ----- | ---------- | ------------------------------ |
95
+ | `x` | `Rational` | The rational number to inspect |
96
96
 
97
97
  Returns:
98
98
 
99
- |type|description|
100
- |----|-----------|
101
- |`Number`|The numerator of the rational number|
99
+ | type | description |
100
+ | -------- | ------------------------------------ |
101
+ | `Number` | The numerator of the rational number |
102
102
 
103
103
  ### Rational.**denominator**
104
104
 
@@ -108,22 +108,22 @@ No other changes yet.
108
108
  </details>
109
109
 
110
110
  ```grain
111
- denominator : (x: Rational) => Number
111
+ denominator: (x: Rational) => Number
112
112
  ```
113
113
 
114
114
  Finds the denominator of the rational number.
115
115
 
116
116
  Parameters:
117
117
 
118
- |param|type|description|
119
- |-----|----|-----------|
120
- |`x`|`Rational`|The rational number to inspect|
118
+ | param | type | description |
119
+ | ----- | ---------- | ------------------------------ |
120
+ | `x` | `Rational` | The rational number to inspect |
121
121
 
122
122
  Returns:
123
123
 
124
- |type|description|
125
- |----|-----------|
126
- |`Number`|The denominator of the rational number|
124
+ | type | description |
125
+ | -------- | -------------------------------------- |
126
+ | `Number` | The denominator of the rational number |
127
127
 
128
128
  ### Rational.**toIntegerRatio**
129
129
 
@@ -133,22 +133,22 @@ No other changes yet.
133
133
  </details>
134
134
 
135
135
  ```grain
136
- toIntegerRatio : (x: Rational) => (Number, Number)
136
+ toIntegerRatio: (x: Rational) => (Number, Number)
137
137
  ```
138
138
 
139
139
  Gets the numerator and denominator of the rational.
140
140
 
141
141
  Parameters:
142
142
 
143
- |param|type|description|
144
- |-----|----|-----------|
145
- |`x`|`Rational`|The rational to split|
143
+ | param | type | description |
144
+ | ----- | ---------- | --------------------- |
145
+ | `x` | `Rational` | The rational to split |
146
146
 
147
147
  Returns:
148
148
 
149
- |type|description|
150
- |----|-----------|
151
- |`(Number, Number)`|The numerator and denominator of the rational|
149
+ | type | description |
150
+ | ------------------ | --------------------------------------------- |
151
+ | `(Number, Number)` | The numerator and denominator of the rational |
152
152
 
153
153
  Examples:
154
154
 
@@ -168,23 +168,23 @@ No other changes yet.
168
168
  </details>
169
169
 
170
170
  ```grain
171
- fromIntegerRatio : (numerator: Number, denominator: Number) => Rational
171
+ fromIntegerRatio: (numerator: Number, denominator: Number) => Rational
172
172
  ```
173
173
 
174
174
  Creates a rational from a numerator and denominator.
175
175
 
176
176
  Parameters:
177
177
 
178
- |param|type|description|
179
- |-----|----|-----------|
180
- |`numerator`|`Number`|The numerator|
181
- |`denominator`|`Number`|The denominator|
178
+ | param | type | description |
179
+ | ------------- | -------- | --------------- |
180
+ | `numerator` | `Number` | The numerator |
181
+ | `denominator` | `Number` | The denominator |
182
182
 
183
183
  Returns:
184
184
 
185
- |type|description|
186
- |----|-----------|
187
- |`Rational`|The reduced rational|
185
+ | type | description |
186
+ | ---------- | -------------------- |
187
+ | `Rational` | The reduced rational |
188
188
 
189
189
  Throws:
190
190
 
@@ -211,23 +211,23 @@ No other changes yet.
211
211
  </details>
212
212
 
213
213
  ```grain
214
- (+) : (x: Rational, y: Rational) => Rational
214
+ (+): (x: Rational, y: Rational) => Rational
215
215
  ```
216
216
 
217
217
  Computes the sum of its operands.
218
218
 
219
219
  Parameters:
220
220
 
221
- |param|type|description|
222
- |-----|----|-----------|
223
- |`x`|`Rational`|The first operand|
224
- |`y`|`Rational`|The second operand|
221
+ | param | type | description |
222
+ | ----- | ---------- | ------------------ |
223
+ | `x` | `Rational` | The first operand |
224
+ | `y` | `Rational` | The second operand |
225
225
 
226
226
  Returns:
227
227
 
228
- |type|description|
229
- |----|-----------|
230
- |`Rational`|The sum of the two operands|
228
+ | type | description |
229
+ | ---------- | --------------------------- |
230
+ | `Rational` | The sum of the two operands |
231
231
 
232
232
  Examples:
233
233
 
@@ -244,23 +244,23 @@ No other changes yet.
244
244
  </details>
245
245
 
246
246
  ```grain
247
- (-) : (x: Rational, y: Rational) => Rational
247
+ (-): (x: Rational, y: Rational) => Rational
248
248
  ```
249
249
 
250
250
  Computes the difference of its operands.
251
251
 
252
252
  Parameters:
253
253
 
254
- |param|type|description|
255
- |-----|----|-----------|
256
- |`x`|`Rational`|The first operand|
257
- |`y`|`Rational`|The second operand|
254
+ | param | type | description |
255
+ | ----- | ---------- | ------------------ |
256
+ | `x` | `Rational` | The first operand |
257
+ | `y` | `Rational` | The second operand |
258
258
 
259
259
  Returns:
260
260
 
261
- |type|description|
262
- |----|-----------|
263
- |`Rational`|The difference of the two operands|
261
+ | type | description |
262
+ | ---------- | ---------------------------------- |
263
+ | `Rational` | The difference of the two operands |
264
264
 
265
265
  Examples:
266
266
 
@@ -277,23 +277,23 @@ No other changes yet.
277
277
  </details>
278
278
 
279
279
  ```grain
280
- (*) : (x: Rational, y: Rational) => Rational
280
+ (*): (x: Rational, y: Rational) => Rational
281
281
  ```
282
282
 
283
283
  Computes the product of its operands.
284
284
 
285
285
  Parameters:
286
286
 
287
- |param|type|description|
288
- |-----|----|-----------|
289
- |`x`|`Rational`|The first operand|
290
- |`y`|`Rational`|The second operand|
287
+ | param | type | description |
288
+ | ----- | ---------- | ------------------ |
289
+ | `x` | `Rational` | The first operand |
290
+ | `y` | `Rational` | The second operand |
291
291
 
292
292
  Returns:
293
293
 
294
- |type|description|
295
- |----|-----------|
296
- |`Rational`|The product of the two operands|
294
+ | type | description |
295
+ | ---------- | ------------------------------- |
296
+ | `Rational` | The product of the two operands |
297
297
 
298
298
  Examples:
299
299
 
@@ -310,23 +310,23 @@ No other changes yet.
310
310
  </details>
311
311
 
312
312
  ```grain
313
- (/) : (x: Rational, y: Rational) => Rational
313
+ (/): (x: Rational, y: Rational) => Rational
314
314
  ```
315
315
 
316
316
  Computes the quotient of its operands.
317
317
 
318
318
  Parameters:
319
319
 
320
- |param|type|description|
321
- |-----|----|-----------|
322
- |`x`|`Rational`|The first operand|
323
- |`y`|`Rational`|The second operand|
320
+ | param | type | description |
321
+ | ----- | ---------- | ------------------ |
322
+ | `x` | `Rational` | The first operand |
323
+ | `y` | `Rational` | The second operand |
324
324
 
325
325
  Returns:
326
326
 
327
- |type|description|
328
- |----|-----------|
329
- |`Rational`|The quotient of the two operands|
327
+ | type | description |
328
+ | ---------- | -------------------------------- |
329
+ | `Rational` | The quotient of the two operands |
330
330
 
331
331
  Examples:
332
332
 
@@ -343,23 +343,23 @@ No other changes yet.
343
343
  </details>
344
344
 
345
345
  ```grain
346
- (==) : (x: Rational, y: Rational) => Bool
346
+ (==): (x: Rational, y: Rational) => Bool
347
347
  ```
348
348
 
349
349
  Checks if the first value is equal to the second value.
350
350
 
351
351
  Parameters:
352
352
 
353
- |param|type|description|
354
- |-----|----|-----------|
355
- |`x`|`Rational`|The first value|
356
- |`y`|`Rational`|The second value|
353
+ | param | type | description |
354
+ | ----- | ---------- | ---------------- |
355
+ | `x` | `Rational` | The first value |
356
+ | `y` | `Rational` | The second value |
357
357
 
358
358
  Returns:
359
359
 
360
- |type|description|
361
- |----|-----------|
362
- |`Bool`|`true` if the first value is equal to the second value or `false` otherwise|
360
+ | type | description |
361
+ | ------ | --------------------------------------------------------------------------- |
362
+ | `Bool` | `true` if the first value is equal to the second value or `false` otherwise |
363
363
 
364
364
  Examples:
365
365
 
@@ -376,23 +376,23 @@ No other changes yet.
376
376
  </details>
377
377
 
378
378
  ```grain
379
- (!=) : (x: Rational, y: Rational) => Bool
379
+ (!=): (x: Rational, y: Rational) => Bool
380
380
  ```
381
381
 
382
382
  Checks if the first value is not equal to the second value.
383
383
 
384
384
  Parameters:
385
385
 
386
- |param|type|description|
387
- |-----|----|-----------|
388
- |`x`|`Rational`|The first value|
389
- |`y`|`Rational`|The second value|
386
+ | param | type | description |
387
+ | ----- | ---------- | ---------------- |
388
+ | `x` | `Rational` | The first value |
389
+ | `y` | `Rational` | The second value |
390
390
 
391
391
  Returns:
392
392
 
393
- |type|description|
394
- |----|-----------|
395
- |`Bool`|`true` if the first value is not equal to the second value or `false` otherwise|
393
+ | type | description |
394
+ | ------ | ------------------------------------------------------------------------------- |
395
+ | `Bool` | `true` if the first value is not equal to the second value or `false` otherwise |
396
396
 
397
397
  Examples:
398
398
 
@@ -409,23 +409,23 @@ No other changes yet.
409
409
  </details>
410
410
 
411
411
  ```grain
412
- (<) : (x: Rational, y: Rational) => Bool
412
+ (<): (x: Rational, y: Rational) => Bool
413
413
  ```
414
414
 
415
415
  Checks if the first value is less than the second value.
416
416
 
417
417
  Parameters:
418
418
 
419
- |param|type|description|
420
- |-----|----|-----------|
421
- |`x`|`Rational`|The first value|
422
- |`y`|`Rational`|The second value|
419
+ | param | type | description |
420
+ | ----- | ---------- | ---------------- |
421
+ | `x` | `Rational` | The first value |
422
+ | `y` | `Rational` | The second value |
423
423
 
424
424
  Returns:
425
425
 
426
- |type|description|
427
- |----|-----------|
428
- |`Bool`|`true` if the first value is less than the second value or `false` otherwise|
426
+ | type | description |
427
+ | ------ | ---------------------------------------------------------------------------- |
428
+ | `Bool` | `true` if the first value is less than the second value or `false` otherwise |
429
429
 
430
430
  Examples:
431
431
 
@@ -442,23 +442,23 @@ No other changes yet.
442
442
  </details>
443
443
 
444
444
  ```grain
445
- (>) : (x: Rational, y: Rational) => Bool
445
+ (>): (x: Rational, y: Rational) => Bool
446
446
  ```
447
447
 
448
448
  Checks if the first value is greater than the second value.
449
449
 
450
450
  Parameters:
451
451
 
452
- |param|type|description|
453
- |-----|----|-----------|
454
- |`x`|`Rational`|The first value|
455
- |`y`|`Rational`|The second value|
452
+ | param | type | description |
453
+ | ----- | ---------- | ---------------- |
454
+ | `x` | `Rational` | The first value |
455
+ | `y` | `Rational` | The second value |
456
456
 
457
457
  Returns:
458
458
 
459
- |type|description|
460
- |----|-----------|
461
- |`Bool`|`true` if the first value is greater than the second value or `false` otherwise|
459
+ | type | description |
460
+ | ------ | ------------------------------------------------------------------------------- |
461
+ | `Bool` | `true` if the first value is greater than the second value or `false` otherwise |
462
462
 
463
463
  Examples:
464
464
 
@@ -475,23 +475,23 @@ No other changes yet.
475
475
  </details>
476
476
 
477
477
  ```grain
478
- (<=) : (x: Rational, y: Rational) => Bool
478
+ (<=): (x: Rational, y: Rational) => Bool
479
479
  ```
480
480
 
481
481
  Checks if the first value is less than or equal to the second value.
482
482
 
483
483
  Parameters:
484
484
 
485
- |param|type|description|
486
- |-----|----|-----------|
487
- |`x`|`Rational`|The first value|
488
- |`y`|`Rational`|The second value|
485
+ | param | type | description |
486
+ | ----- | ---------- | ---------------- |
487
+ | `x` | `Rational` | The first value |
488
+ | `y` | `Rational` | The second value |
489
489
 
490
490
  Returns:
491
491
 
492
- |type|description|
493
- |----|-----------|
494
- |`Bool`|`true` if the first value is less than or equal to the second value or `false` otherwise|
492
+ | type | description |
493
+ | ------ | ---------------------------------------------------------------------------------------- |
494
+ | `Bool` | `true` if the first value is less than or equal to the second value or `false` otherwise |
495
495
 
496
496
  Examples:
497
497
 
@@ -513,23 +513,23 @@ No other changes yet.
513
513
  </details>
514
514
 
515
515
  ```grain
516
- (>=) : (x: Rational, y: Rational) => Bool
516
+ (>=): (x: Rational, y: Rational) => Bool
517
517
  ```
518
518
 
519
519
  Checks if the first value is greater than or equal to the second value.
520
520
 
521
521
  Parameters:
522
522
 
523
- |param|type|description|
524
- |-----|----|-----------|
525
- |`x`|`Rational`|The first value|
526
- |`y`|`Rational`|The second value|
523
+ | param | type | description |
524
+ | ----- | ---------- | ---------------- |
525
+ | `x` | `Rational` | The first value |
526
+ | `y` | `Rational` | The second value |
527
527
 
528
528
  Returns:
529
529
 
530
- |type|description|
531
- |----|-----------|
532
- |`Bool`|`true` if the first value is greater than or equal to the second value or `false` otherwise|
530
+ | type | description |
531
+ | ------ | ------------------------------------------------------------------------------------------- |
532
+ | `Bool` | `true` if the first value is greater than or equal to the second value or `false` otherwise |
533
533
 
534
534
  Examples:
535
535