@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.
Files changed (62) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/array.md +491 -491
  3. package/bigint.md +198 -198
  4. package/buffer.gr +66 -1
  5. package/buffer.md +395 -272
  6. package/bytes.gr +1 -0
  7. package/bytes.md +200 -199
  8. package/char.md +125 -125
  9. package/exception.md +9 -9
  10. package/float32.md +195 -195
  11. package/float64.md +195 -195
  12. package/fs.md +115 -115
  13. package/hash.md +16 -16
  14. package/int16.md +155 -155
  15. package/int32.gr +1 -1
  16. package/int32.md +207 -207
  17. package/int64.gr +1 -1
  18. package/int64.md +207 -207
  19. package/int8.md +155 -155
  20. package/json.md +59 -59
  21. package/list.md +347 -347
  22. package/map.md +222 -222
  23. package/marshal.md +12 -12
  24. package/number.gr +119 -5
  25. package/number.md +503 -261
  26. package/option.md +141 -141
  27. package/package.json +2 -2
  28. package/path.gr +82 -65
  29. package/path.md +210 -141
  30. package/pervasives.md +238 -238
  31. package/priorityqueue.md +112 -112
  32. package/queue.md +117 -117
  33. package/random.md +37 -37
  34. package/range.md +36 -36
  35. package/rational.md +107 -107
  36. package/regex.md +91 -91
  37. package/result.md +102 -102
  38. package/runtime/atof/decimal.md +6 -6
  39. package/runtime/compare.md +7 -7
  40. package/runtime/dataStructures.md +178 -178
  41. package/runtime/equal.md +7 -7
  42. package/runtime/exception.md +15 -15
  43. package/runtime/malloc.md +9 -9
  44. package/runtime/numbers.md +269 -269
  45. package/runtime/string.md +17 -17
  46. package/runtime/unsafe/conv.md +6 -6
  47. package/runtime/unsafe/memory.gr +2 -19
  48. package/runtime/unsafe/memory.md +10 -10
  49. package/runtime/utf8.md +31 -31
  50. package/runtime/wasi.md +9 -9
  51. package/set.md +211 -211
  52. package/stack.md +122 -122
  53. package/string.md +228 -228
  54. package/uint16.md +148 -148
  55. package/uint32.md +192 -192
  56. package/uint64.md +192 -192
  57. package/uint8.md +148 -148
  58. package/uri.md +77 -77
  59. package/wasi/file.md +269 -269
  60. package/wasi/process.md +21 -21
  61. package/wasi/random.md +9 -9
  62. package/wasi/time.md +12 -12
package/queue.md CHANGED
@@ -59,15 +59,15 @@ default size.
59
59
 
60
60
  Parameters:
61
61
 
62
- |param|type|description|
63
- |-----|----|-----------|
64
- |`?size`|`Number`|The initial storage size of the queue|
62
+ | param | type | description |
63
+ | ------- | -------- | ------------------------------------- |
64
+ | `?size` | `Number` | The initial storage size of the queue |
65
65
 
66
66
  Returns:
67
67
 
68
- |type|description|
69
- |----|-----------|
70
- |`Queue<a>`|An empty queue|
68
+ | type | description |
69
+ | ---------- | -------------- |
70
+ | `Queue<a>` | An empty queue |
71
71
 
72
72
  Examples:
73
73
 
@@ -94,15 +94,15 @@ Checks if the given queue contains no items.
94
94
 
95
95
  Parameters:
96
96
 
97
- |param|type|description|
98
- |-----|----|-----------|
99
- |`queue`|`Queue<a>`|The queue to check|
97
+ | param | type | description |
98
+ | ------- | ---------- | ------------------ |
99
+ | `queue` | `Queue<a>` | The queue to check |
100
100
 
101
101
  Returns:
102
102
 
103
- |type|description|
104
- |----|-----------|
105
- |`Bool`|`true` if the queue has no items or `false` otherwise|
103
+ | type | description |
104
+ | ------ | ----------------------------------------------------- |
105
+ | `Bool` | `true` if the queue has no items or `false` otherwise |
106
106
 
107
107
  Examples:
108
108
 
@@ -129,15 +129,15 @@ Computes the size of the input queue.
129
129
 
130
130
  Parameters:
131
131
 
132
- |param|type|description|
133
- |-----|----|-----------|
134
- |`queue`|`Queue<a>`|The queue to inspect|
132
+ | param | type | description |
133
+ | ------- | ---------- | -------------------- |
134
+ | `queue` | `Queue<a>` | The queue to inspect |
135
135
 
136
136
  Returns:
137
137
 
138
- |type|description|
139
- |----|-----------|
140
- |`Number`|The count of the items in the queue|
138
+ | type | description |
139
+ | -------- | ----------------------------------- |
140
+ | `Number` | The count of the items in the queue |
141
141
 
142
142
  Examples:
143
143
 
@@ -164,15 +164,15 @@ Provides the value at the beginning of the queue, if it exists.
164
164
 
165
165
  Parameters:
166
166
 
167
- |param|type|description|
168
- |-----|----|-----------|
169
- |`queue`|`Queue<a>`|The queue to inspect|
167
+ | param | type | description |
168
+ | ------- | ---------- | -------------------- |
169
+ | `queue` | `Queue<a>` | The queue to inspect |
170
170
 
171
171
  Returns:
172
172
 
173
- |type|description|
174
- |----|-----------|
175
- |`Option<a>`|`Some(value)` containing the value at the beginning of the queue or `None` otherwise.|
173
+ | type | description |
174
+ | ----------- | ------------------------------------------------------------------------------------- |
175
+ | `Option<a>` | `Some(value)` containing the value at the beginning of the queue or `None` otherwise. |
176
176
 
177
177
  Examples:
178
178
 
@@ -201,10 +201,10 @@ Adds a new item to the end of the queue.
201
201
 
202
202
  Parameters:
203
203
 
204
- |param|type|description|
205
- |-----|----|-----------|
206
- |`value`|`a`|The item to be added|
207
- |`queue`|`Queue<a>`|The queue being updated|
204
+ | param | type | description |
205
+ | ------- | ---------- | ----------------------- |
206
+ | `value` | `a` | The item to be added |
207
+ | `queue` | `Queue<a>` | The queue being updated |
208
208
 
209
209
  Examples:
210
210
 
@@ -230,15 +230,15 @@ Removes the item at the beginning of the queue.
230
230
 
231
231
  Parameters:
232
232
 
233
- |param|type|description|
234
- |-----|----|-----------|
235
- |`queue`|`Queue<a>`|The queue being updated|
233
+ | param | type | description |
234
+ | ------- | ---------- | ----------------------- |
235
+ | `queue` | `Queue<a>` | The queue being updated |
236
236
 
237
237
  Returns:
238
238
 
239
- |type|description|
240
- |----|-----------|
241
- |`Option<a>`|The element removed from the queue|
239
+ | type | description |
240
+ | ----------- | ---------------------------------- |
241
+ | `Option<a>` | The element removed from the queue |
242
242
 
243
243
  Examples:
244
244
 
@@ -264,9 +264,9 @@ Clears the queue by removing all of its elements.
264
264
 
265
265
  Parameters:
266
266
 
267
- |param|type|description|
268
- |-----|----|-----------|
269
- |`queue`|`Queue<a>`|The queue to clear|
267
+ | param | type | description |
268
+ | ------- | ---------- | ------------------ |
269
+ | `queue` | `Queue<a>` | The queue to clear |
270
270
 
271
271
  Examples:
272
272
 
@@ -293,15 +293,15 @@ Produces a shallow copy of the input queue.
293
293
 
294
294
  Parameters:
295
295
 
296
- |param|type|description|
297
- |-----|----|-----------|
298
- |`queue`|`Queue<a>`|The queue to copy|
296
+ | param | type | description |
297
+ | ------- | ---------- | ----------------- |
298
+ | `queue` | `Queue<a>` | The queue to copy |
299
299
 
300
300
  Returns:
301
301
 
302
- |type|description|
303
- |----|-----------|
304
- |`Queue<a>`|A new queue containing the elements from the input|
302
+ | type | description |
303
+ | ---------- | -------------------------------------------------- |
304
+ | `Queue<a>` | A new queue containing the elements from the input |
305
305
 
306
306
  Examples:
307
307
 
@@ -328,15 +328,15 @@ Converts a queue into a list of its elements.
328
328
 
329
329
  Parameters:
330
330
 
331
- |param|type|description|
332
- |-----|----|-----------|
333
- |`queue`|`Queue<a>`|The queue to convert|
331
+ | param | type | description |
332
+ | ------- | ---------- | -------------------- |
333
+ | `queue` | `Queue<a>` | The queue to convert |
334
334
 
335
335
  Returns:
336
336
 
337
- |type|description|
338
- |----|-----------|
339
- |`List<a>`|A list containing all queue values|
337
+ | type | description |
338
+ | --------- | ---------------------------------- |
339
+ | `List<a>` | A list containing all queue values |
340
340
 
341
341
  Examples:
342
342
 
@@ -363,15 +363,15 @@ Creates a queue from a list.
363
363
 
364
364
  Parameters:
365
365
 
366
- |param|type|description|
367
- |-----|----|-----------|
368
- |`list`|`List<a>`|The list to convert|
366
+ | param | type | description |
367
+ | ------ | --------- | ------------------- |
368
+ | `list` | `List<a>` | The list to convert |
369
369
 
370
370
  Returns:
371
371
 
372
- |type|description|
373
- |----|-----------|
374
- |`Queue<a>`|A queue containing all list values|
372
+ | type | description |
373
+ | ---------- | ---------------------------------- |
374
+ | `Queue<a>` | A queue containing all list values |
375
375
 
376
376
  Examples:
377
377
 
@@ -396,15 +396,15 @@ Converts a queue into an array of its values.
396
396
 
397
397
  Parameters:
398
398
 
399
- |param|type|description|
400
- |-----|----|-----------|
401
- |`queue`|`Queue<a>`|The queue to convert|
399
+ | param | type | description |
400
+ | ------- | ---------- | -------------------- |
401
+ | `queue` | `Queue<a>` | The queue to convert |
402
402
 
403
403
  Returns:
404
404
 
405
- |type|description|
406
- |----|-----------|
407
- |`Array<a>`|An array containing all values from the given queue|
405
+ | type | description |
406
+ | ---------- | --------------------------------------------------- |
407
+ | `Array<a>` | An array containing all values from the given queue |
408
408
 
409
409
  Examples:
410
410
 
@@ -431,15 +431,15 @@ Creates a queue from an array.
431
431
 
432
432
  Parameters:
433
433
 
434
- |param|type|description|
435
- |-----|----|-----------|
436
- |`arr`|`Array<a>`|The array to convert|
434
+ | param | type | description |
435
+ | ----- | ---------- | -------------------- |
436
+ | `arr` | `Array<a>` | The array to convert |
437
437
 
438
438
  Returns:
439
439
 
440
- |type|description|
441
- |----|-----------|
442
- |`Queue<a>`|A queue containing all values from the array|
440
+ | type | description |
441
+ | ---------- | -------------------------------------------- |
442
+ | `Queue<a>` | A queue containing all values from the array |
443
443
 
444
444
  Examples:
445
445
 
@@ -464,16 +464,16 @@ Checks if two queues are equivalent by value.
464
464
 
465
465
  Parameters:
466
466
 
467
- |param|type|description|
468
- |-----|----|-----------|
469
- |`queue1`|`Queue<a>`|The first queue to compare|
470
- |`queue2`|`Queue<a>`|The second queue to compare|
467
+ | param | type | description |
468
+ | -------- | ---------- | --------------------------- |
469
+ | `queue1` | `Queue<a>` | The first queue to compare |
470
+ | `queue2` | `Queue<a>` | The second queue to compare |
471
471
 
472
472
  Returns:
473
473
 
474
- |type|description|
475
- |----|-----------|
476
- |`Bool`|`true` if the queues are equivalent or `false` otherwise|
474
+ | type | description |
475
+ | ------ | -------------------------------------------------------- |
476
+ | `Bool` | `true` if the queues are equivalent or `false` otherwise |
477
477
 
478
478
  Examples:
479
479
 
@@ -587,15 +587,15 @@ Checks if the given queue contains any values.
587
587
 
588
588
  Parameters:
589
589
 
590
- |param|type|description|
591
- |-----|----|-----------|
592
- |`queue`|`ImmutableQueue<a>`|The queue to check|
590
+ | param | type | description |
591
+ | ------- | ------------------- | ------------------ |
592
+ | `queue` | `ImmutableQueue<a>` | The queue to check |
593
593
 
594
594
  Returns:
595
595
 
596
- |type|description|
597
- |----|-----------|
598
- |`Bool`|`true` if the given queue is empty or `false` otherwise|
596
+ | type | description |
597
+ | ------ | ------------------------------------------------------- |
598
+ | `Bool` | `true` if the given queue is empty or `false` otherwise |
599
599
 
600
600
  Examples:
601
601
 
@@ -632,15 +632,15 @@ Returns the value at the beginning of the queue. It is not removed from the queu
632
632
 
633
633
  Parameters:
634
634
 
635
- |param|type|description|
636
- |-----|----|-----------|
637
- |`queue`|`ImmutableQueue<a>`|The queue to inspect|
635
+ | param | type | description |
636
+ | ------- | ------------------- | -------------------- |
637
+ | `queue` | `ImmutableQueue<a>` | The queue to inspect |
638
638
 
639
639
  Returns:
640
640
 
641
- |type|description|
642
- |----|-----------|
643
- |`Option<a>`|`Some(value)` containing the value at the beginning of the queue, or `None` if the queue is empty|
641
+ | type | description |
642
+ | ----------- | ------------------------------------------------------------------------------------------------- |
643
+ | `Option<a>` | `Some(value)` containing the value at the beginning of the queue, or `None` if the queue is empty |
644
644
 
645
645
  Examples:
646
646
 
@@ -679,16 +679,16 @@ Adds a value to the end of the queue.
679
679
 
680
680
  Parameters:
681
681
 
682
- |param|type|description|
683
- |-----|----|-----------|
684
- |`value`|`a`|The value to append|
685
- |`queue`|`ImmutableQueue<a>`|The queue to update|
682
+ | param | type | description |
683
+ | ------- | ------------------- | ------------------- |
684
+ | `value` | `a` | The value to append |
685
+ | `queue` | `ImmutableQueue<a>` | The queue to update |
686
686
 
687
687
  Returns:
688
688
 
689
- |type|description|
690
- |----|-----------|
691
- |`ImmutableQueue<a>`|An updated queue|
689
+ | type | description |
690
+ | ------------------- | ---------------- |
691
+ | `ImmutableQueue<a>` | An updated queue |
692
692
 
693
693
  Examples:
694
694
 
@@ -724,15 +724,15 @@ Dequeues the next value in the queue.
724
724
 
725
725
  Parameters:
726
726
 
727
- |param|type|description|
728
- |-----|----|-----------|
729
- |`queue`|`ImmutableQueue<a>`|The queue to change|
727
+ | param | type | description |
728
+ | ------- | ------------------- | ------------------- |
729
+ | `queue` | `ImmutableQueue<a>` | The queue to change |
730
730
 
731
731
  Returns:
732
732
 
733
- |type|description|
734
- |----|-----------|
735
- |`ImmutableQueue<a>`|An updated queue|
733
+ | type | description |
734
+ | ------------------- | ---------------- |
735
+ | `ImmutableQueue<a>` | An updated queue |
736
736
 
737
737
  Examples:
738
738
 
@@ -770,15 +770,15 @@ Get the number of values in a queue.
770
770
 
771
771
  Parameters:
772
772
 
773
- |param|type|description|
774
- |-----|----|-----------|
775
- |`queue`|`ImmutableQueue<a>`|The queue to inspect|
773
+ | param | type | description |
774
+ | ------- | ------------------- | -------------------- |
775
+ | `queue` | `ImmutableQueue<a>` | The queue to inspect |
776
776
 
777
777
  Returns:
778
778
 
779
- |type|description|
780
- |----|-----------|
781
- |`Number`|The number of values in the queue|
779
+ | type | description |
780
+ | -------- | --------------------------------- |
781
+ | `Number` | The number of values in the queue |
782
782
 
783
783
  Examples:
784
784
 
@@ -805,15 +805,15 @@ Converts a queue into a list of its elements.
805
805
 
806
806
  Parameters:
807
807
 
808
- |param|type|description|
809
- |-----|----|-----------|
810
- |`queue`|`ImmutableQueue<a>`|The queue to convert|
808
+ | param | type | description |
809
+ | ------- | ------------------- | -------------------- |
810
+ | `queue` | `ImmutableQueue<a>` | The queue to convert |
811
811
 
812
812
  Returns:
813
813
 
814
- |type|description|
815
- |----|-----------|
816
- |`List<a>`|A list containing all queue values|
814
+ | type | description |
815
+ | --------- | ---------------------------------- |
816
+ | `List<a>` | A list containing all queue values |
817
817
 
818
818
  Examples:
819
819
 
@@ -849,15 +849,15 @@ Creates a queue from a list.
849
849
 
850
850
  Parameters:
851
851
 
852
- |param|type|description|
853
- |-----|----|-----------|
854
- |`list`|`List<a>`|The list to convert|
852
+ | param | type | description |
853
+ | ------ | --------- | ------------------- |
854
+ | `list` | `List<a>` | The list to convert |
855
855
 
856
856
  Returns:
857
857
 
858
- |type|description|
859
- |----|-----------|
860
- |`ImmutableQueue<a>`|A queue containing all list values|
858
+ | type | description |
859
+ | ------------------- | ---------------------------------- |
860
+ | `ImmutableQueue<a>` | A queue containing all list values |
861
861
 
862
862
  Examples:
863
863
 
package/random.md CHANGED
@@ -42,15 +42,15 @@ Creates a new pseudo-random number generator with the given seed.
42
42
 
43
43
  Parameters:
44
44
 
45
- |param|type|description|
46
- |-----|----|-----------|
47
- |`seed`|`Uint64`|The seed for the pseudo-random number generator|
45
+ | param | type | description |
46
+ | ------ | -------- | ----------------------------------------------- |
47
+ | `seed` | `Uint64` | The seed for the pseudo-random number generator |
48
48
 
49
49
  Returns:
50
50
 
51
- |type|description|
52
- |----|-----------|
53
- |`Random`|The pseudo-random number generator|
51
+ | type | description |
52
+ | -------- | ---------------------------------- |
53
+ | `Random` | The pseudo-random number generator |
54
54
 
55
55
  ### Random.**makeUnseeded**
56
56
 
@@ -67,9 +67,9 @@ Creates a new pseudo-random number generator with a random seed.
67
67
 
68
68
  Returns:
69
69
 
70
- |type|description|
71
- |----|-----------|
72
- |`Result<Random, Exception>`|`Ok(generator)` of a pseudo-random number generator if successful or `Err(exception)` otherwise|
70
+ | type | description |
71
+ | --------------------------- | ----------------------------------------------------------------------------------------------- |
72
+ | `Result<Random, Exception>` | `Ok(generator)` of a pseudo-random number generator if successful or `Err(exception)` otherwise |
73
73
 
74
74
  ### Random.**nextUint32**
75
75
 
@@ -93,15 +93,15 @@ Generates a random 32-bit integer from the given pseudo-random number generator.
93
93
 
94
94
  Parameters:
95
95
 
96
- |param|type|description|
97
- |-----|----|-----------|
98
- |`random`|`Random`|The pseudo-random number generator to use|
96
+ | param | type | description |
97
+ | -------- | -------- | ----------------------------------------- |
98
+ | `random` | `Random` | The pseudo-random number generator to use |
99
99
 
100
100
  Returns:
101
101
 
102
- |type|description|
103
- |----|-----------|
104
- |`Uint32`|The randomly generated number|
102
+ | type | description |
103
+ | -------- | ----------------------------- |
104
+ | `Uint32` | The randomly generated number |
105
105
 
106
106
  ### Random.**nextUint64**
107
107
 
@@ -125,15 +125,15 @@ Generates a random 64-bit integer from the given pseudo-random number generator.
125
125
 
126
126
  Parameters:
127
127
 
128
- |param|type|description|
129
- |-----|----|-----------|
130
- |`random`|`Random`|The pseudo-random number generator to use|
128
+ | param | type | description |
129
+ | -------- | -------- | ----------------------------------------- |
130
+ | `random` | `Random` | The pseudo-random number generator to use |
131
131
 
132
132
  Returns:
133
133
 
134
- |type|description|
135
- |----|-----------|
136
- |`Uint64`|The randomly generated number|
134
+ | type | description |
135
+ | -------- | ----------------------------- |
136
+ | `Uint64` | The randomly generated number |
137
137
 
138
138
  ### Random.**nextUint32InRange**
139
139
 
@@ -158,17 +158,17 @@ from a uniform distribution in the given range.
158
158
 
159
159
  Parameters:
160
160
 
161
- |param|type|description|
162
- |-----|----|-----------|
163
- |`random`|`Random`|The pseudo-random number generator to use|
164
- |`low`|`Uint32`|The lower bound of the range (inclusive)|
165
- |`high`|`Uint32`|The upper bound of the range (exclusive)|
161
+ | param | type | description |
162
+ | -------- | -------- | ----------------------------------------- |
163
+ | `random` | `Random` | The pseudo-random number generator to use |
164
+ | `low` | `Uint32` | The lower bound of the range (inclusive) |
165
+ | `high` | `Uint32` | The upper bound of the range (exclusive) |
166
166
 
167
167
  Returns:
168
168
 
169
- |type|description|
170
- |----|-----------|
171
- |`Uint32`|The randomly generated number|
169
+ | type | description |
170
+ | -------- | ----------------------------- |
171
+ | `Uint32` | The randomly generated number |
172
172
 
173
173
  ### Random.**nextUint64InRange**
174
174
 
@@ -193,15 +193,15 @@ from a uniform distribution in the given range.
193
193
 
194
194
  Parameters:
195
195
 
196
- |param|type|description|
197
- |-----|----|-----------|
198
- |`random`|`Random`|The pseudo-random number generator to use|
199
- |`low`|`Uint64`|The lower bound of the range (inclusive)|
200
- |`high`|`Uint64`|The upper bound of the range (exclusive)|
196
+ | param | type | description |
197
+ | -------- | -------- | ----------------------------------------- |
198
+ | `random` | `Random` | The pseudo-random number generator to use |
199
+ | `low` | `Uint64` | The lower bound of the range (inclusive) |
200
+ | `high` | `Uint64` | The upper bound of the range (exclusive) |
201
201
 
202
202
  Returns:
203
203
 
204
- |type|description|
205
- |----|-----------|
206
- |`Uint64`|The randomly generated number|
204
+ | type | description |
205
+ | -------- | ----------------------------- |
206
+ | `Uint64` | The randomly generated number |
207
207