@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/char.md
CHANGED
|
@@ -93,15 +93,15 @@ Determines whether the given character code is a valid Unicode scalar value.
|
|
|
93
93
|
|
|
94
94
|
Parameters:
|
|
95
95
|
|
|
96
|
-
|param|type|description|
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
| param | type | description |
|
|
97
|
+
| ---------- | -------- | ------------------- |
|
|
98
|
+
| `charCode` | `Number` | The number to check |
|
|
99
99
|
|
|
100
100
|
Returns:
|
|
101
101
|
|
|
102
|
-
|type|description|
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
| type | description |
|
|
103
|
+
| ------ | -------------------------------------------------------------------------------- |
|
|
104
|
+
| `Bool` | `true` if the number refers to a valid Unicode scalar value or `false` otherwise |
|
|
105
105
|
|
|
106
106
|
Examples:
|
|
107
107
|
|
|
@@ -128,15 +128,15 @@ Determines the Unicode scalar value for a character.
|
|
|
128
128
|
|
|
129
129
|
Parameters:
|
|
130
130
|
|
|
131
|
-
|param|type|description|
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
| param | type | description |
|
|
132
|
+
| ------ | ------ | ------------- |
|
|
133
|
+
| `char` | `Char` | The character |
|
|
134
134
|
|
|
135
135
|
Returns:
|
|
136
136
|
|
|
137
|
-
|type|description|
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
| type | description |
|
|
138
|
+
| -------- | ------------------------------------------------ |
|
|
139
|
+
| `Number` | The Unicode scalar value for the given character |
|
|
140
140
|
|
|
141
141
|
Examples:
|
|
142
142
|
|
|
@@ -163,15 +163,15 @@ Creates a character from the given Unicode scalar value.
|
|
|
163
163
|
|
|
164
164
|
Parameters:
|
|
165
165
|
|
|
166
|
-
|param|type|description|
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
| param | type | description |
|
|
167
|
+
| ----- | -------- | ------------------------ |
|
|
168
|
+
| `usv` | `Number` | The Unicode scalar value |
|
|
169
169
|
|
|
170
170
|
Returns:
|
|
171
171
|
|
|
172
|
-
|type|description|
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
| type | description |
|
|
173
|
+
| ------ | ------------------------------------------------ |
|
|
174
|
+
| `Char` | The character for the given Unicode scalar value |
|
|
175
175
|
|
|
176
176
|
Throws:
|
|
177
177
|
|
|
@@ -204,15 +204,15 @@ Returns the next valid character by Unicode scalar value.
|
|
|
204
204
|
|
|
205
205
|
Parameters:
|
|
206
206
|
|
|
207
|
-
|param|type|description|
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
| param | type | description |
|
|
208
|
+
| ------ | ------ | ------------- |
|
|
209
|
+
| `char` | `Char` | The character |
|
|
210
210
|
|
|
211
211
|
Returns:
|
|
212
212
|
|
|
213
|
-
|type|description|
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
| type | description |
|
|
214
|
+
| ------ | ------------------------------------------------ |
|
|
215
|
+
| `Char` | The next valid character by Unicode scalar value |
|
|
216
216
|
|
|
217
217
|
Throws:
|
|
218
218
|
|
|
@@ -245,15 +245,15 @@ Returns the previous valid character by Unicode scalar value.
|
|
|
245
245
|
|
|
246
246
|
Parameters:
|
|
247
247
|
|
|
248
|
-
|param|type|description|
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
| param | type | description |
|
|
249
|
+
| ------ | ------ | ------------- |
|
|
250
|
+
| `char` | `Char` | The character |
|
|
251
251
|
|
|
252
252
|
Returns:
|
|
253
253
|
|
|
254
|
-
|type|description|
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
| type | description |
|
|
255
|
+
| ------ | ---------------------------------------------------- |
|
|
256
|
+
| `Char` | The previous valid character by Unicode scalar value |
|
|
257
257
|
|
|
258
258
|
Throws:
|
|
259
259
|
|
|
@@ -286,15 +286,15 @@ Converts the given character to a string.
|
|
|
286
286
|
|
|
287
287
|
Parameters:
|
|
288
288
|
|
|
289
|
-
|param|type|description|
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
| param | type | description |
|
|
290
|
+
| ------ | ------ | ------------------------ |
|
|
291
|
+
| `char` | `Char` | The character to convert |
|
|
292
292
|
|
|
293
293
|
Returns:
|
|
294
294
|
|
|
295
|
-
|type|description|
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
| type | description |
|
|
296
|
+
| -------- | --------------------------------------- |
|
|
297
|
+
| `String` | A string containing the given character |
|
|
298
298
|
|
|
299
299
|
Examples:
|
|
300
300
|
|
|
@@ -321,16 +321,16 @@ Returns the byte count of a character if encoded in the given encoding.
|
|
|
321
321
|
|
|
322
322
|
Parameters:
|
|
323
323
|
|
|
324
|
-
|param|type|description|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
| param | type | description |
|
|
325
|
+
| ---------- | ---------- | --------------------- |
|
|
326
|
+
| `encoding` | `Encoding` | The encoding to check |
|
|
327
|
+
| `char` | `Char` | The character |
|
|
328
328
|
|
|
329
329
|
Returns:
|
|
330
330
|
|
|
331
|
-
|type|description|
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
| type | description |
|
|
332
|
+
| -------- | ----------------------------------------------------- |
|
|
333
|
+
| `Number` | The byte count of the character in the given encoding |
|
|
334
334
|
|
|
335
335
|
Examples:
|
|
336
336
|
|
|
@@ -361,16 +361,16 @@ Checks if the first character is less than the second character by Unicode scala
|
|
|
361
361
|
|
|
362
362
|
Parameters:
|
|
363
363
|
|
|
364
|
-
|param|type|description|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
364
|
+
| param | type | description |
|
|
365
|
+
| ----- | ------ | -------------------- |
|
|
366
|
+
| `x` | `Char` | The first character |
|
|
367
|
+
| `y` | `Char` | The second character |
|
|
368
368
|
|
|
369
369
|
Returns:
|
|
370
370
|
|
|
371
|
-
|type|description|
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
| type | description |
|
|
372
|
+
| ------ | ------------------------------------------------------------------------------------ |
|
|
373
|
+
| `Bool` | `true` if the first character is less than the second character or `false` otherwise |
|
|
374
374
|
|
|
375
375
|
Examples:
|
|
376
376
|
|
|
@@ -399,16 +399,16 @@ Checks if the first character is less than or equal to the second character by U
|
|
|
399
399
|
|
|
400
400
|
Parameters:
|
|
401
401
|
|
|
402
|
-
|param|type|description|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
402
|
+
| param | type | description |
|
|
403
|
+
| ----- | ------ | -------------------- |
|
|
404
|
+
| `x` | `Char` | The first character |
|
|
405
|
+
| `y` | `Char` | The second character |
|
|
406
406
|
|
|
407
407
|
Returns:
|
|
408
408
|
|
|
409
|
-
|type|description|
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
| type | description |
|
|
410
|
+
| ------ | ------------------------------------------------------------------------------------------------ |
|
|
411
|
+
| `Bool` | `true` if the first character is less than or equal to the second character or `false` otherwise |
|
|
412
412
|
|
|
413
413
|
Examples:
|
|
414
414
|
|
|
@@ -442,16 +442,16 @@ Checks if the first character is greater than the second character by Unicode sc
|
|
|
442
442
|
|
|
443
443
|
Parameters:
|
|
444
444
|
|
|
445
|
-
|param|type|description|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
445
|
+
| param | type | description |
|
|
446
|
+
| ----- | ------ | -------------------- |
|
|
447
|
+
| `x` | `Char` | The first character |
|
|
448
|
+
| `y` | `Char` | The second character |
|
|
449
449
|
|
|
450
450
|
Returns:
|
|
451
451
|
|
|
452
|
-
|type|description|
|
|
453
|
-
|
|
454
|
-
|
|
452
|
+
| type | description |
|
|
453
|
+
| ------ | --------------------------------------------------------------------------------------- |
|
|
454
|
+
| `Bool` | `true` if the first character is greater than the second character or `false` otherwise |
|
|
455
455
|
|
|
456
456
|
Examples:
|
|
457
457
|
|
|
@@ -480,16 +480,16 @@ Checks if the first character is greater than or equal to the second character b
|
|
|
480
480
|
|
|
481
481
|
Parameters:
|
|
482
482
|
|
|
483
|
-
|param|type|description|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
| param | type | description |
|
|
484
|
+
| ----- | ------ | -------------------- |
|
|
485
|
+
| `x` | `Char` | The first character |
|
|
486
|
+
| `y` | `Char` | The second character |
|
|
487
487
|
|
|
488
488
|
Returns:
|
|
489
489
|
|
|
490
|
-
|type|description|
|
|
491
|
-
|
|
492
|
-
|
|
490
|
+
| type | description |
|
|
491
|
+
| ------ | --------------------------------------------------------------------------------------------------- |
|
|
492
|
+
| `Bool` | `true` if the first character is greater than or equal to the second character or `false` otherwise |
|
|
493
493
|
|
|
494
494
|
Examples:
|
|
495
495
|
|
|
@@ -566,15 +566,15 @@ Checks if the character is a valid ASCII character.
|
|
|
566
566
|
|
|
567
567
|
Parameters:
|
|
568
568
|
|
|
569
|
-
|param|type|description|
|
|
570
|
-
|
|
571
|
-
|
|
569
|
+
| param | type | description |
|
|
570
|
+
| ------ | ------ | ---------------------- |
|
|
571
|
+
| `char` | `Char` | The character to check |
|
|
572
572
|
|
|
573
573
|
Returns:
|
|
574
574
|
|
|
575
|
-
|type|description|
|
|
576
|
-
|
|
577
|
-
|
|
575
|
+
| type | description |
|
|
576
|
+
| ------ | ------------------------------------------------------------------ |
|
|
577
|
+
| `Bool` | `true` if the character is an ASCII character or `false` otherwise |
|
|
578
578
|
|
|
579
579
|
Examples:
|
|
580
580
|
|
|
@@ -612,15 +612,15 @@ Checks if the character is an ASCII digit.
|
|
|
612
612
|
|
|
613
613
|
Parameters:
|
|
614
614
|
|
|
615
|
-
|param|type|description|
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
| param | type | description |
|
|
616
|
+
| ------ | ------ | ---------------------- |
|
|
617
|
+
| `char` | `Char` | The character to check |
|
|
618
618
|
|
|
619
619
|
Returns:
|
|
620
620
|
|
|
621
|
-
|type|description|
|
|
622
|
-
|
|
623
|
-
|
|
621
|
+
| type | description |
|
|
622
|
+
| ------ | -------------------------------------------------------------- |
|
|
623
|
+
| `Bool` | `true` if the character is an ASCII digit or `false` otherwise |
|
|
624
624
|
|
|
625
625
|
Examples:
|
|
626
626
|
|
|
@@ -654,15 +654,15 @@ Checks if the character is an ASCII alphabetical character.
|
|
|
654
654
|
|
|
655
655
|
Parameters:
|
|
656
656
|
|
|
657
|
-
|param|type|description|
|
|
658
|
-
|
|
659
|
-
|
|
657
|
+
| param | type | description |
|
|
658
|
+
| ------ | ------ | ---------------------- |
|
|
659
|
+
| `char` | `Char` | The character to check |
|
|
660
660
|
|
|
661
661
|
Returns:
|
|
662
662
|
|
|
663
|
-
|type|description|
|
|
664
|
-
|
|
665
|
-
|
|
663
|
+
| type | description |
|
|
664
|
+
| ------ | --------------------------------------------------------------------- |
|
|
665
|
+
| `Bool` | `true` if the character is an ASCII alphabetical or `false` otherwise |
|
|
666
666
|
|
|
667
667
|
Examples:
|
|
668
668
|
|
|
@@ -689,15 +689,15 @@ Checks if the character is an ASCII control character.
|
|
|
689
689
|
|
|
690
690
|
Parameters:
|
|
691
691
|
|
|
692
|
-
|param|type|description|
|
|
693
|
-
|
|
694
|
-
|
|
692
|
+
| param | type | description |
|
|
693
|
+
| ------ | ------ | ---------------------- |
|
|
694
|
+
| `char` | `Char` | The character to check |
|
|
695
695
|
|
|
696
696
|
Returns:
|
|
697
697
|
|
|
698
|
-
|type|description|
|
|
699
|
-
|
|
700
|
-
|
|
698
|
+
| type | description |
|
|
699
|
+
| ------ | -------------------------------------------------------------------------- |
|
|
700
|
+
| `Bool` | `true` if the character is an ASCII control character or `false` otherwise |
|
|
701
701
|
|
|
702
702
|
Examples:
|
|
703
703
|
|
|
@@ -732,15 +732,15 @@ Checks if the character is an ASCII whitespace character.
|
|
|
732
732
|
|
|
733
733
|
Parameters:
|
|
734
734
|
|
|
735
|
-
|param|type|description|
|
|
736
|
-
|
|
737
|
-
|
|
735
|
+
| param | type | description |
|
|
736
|
+
| ------ | ------ | ---------------------- |
|
|
737
|
+
| `char` | `Char` | The character to check |
|
|
738
738
|
|
|
739
739
|
Returns:
|
|
740
740
|
|
|
741
|
-
|type|description|
|
|
742
|
-
|
|
743
|
-
|
|
741
|
+
| type | description |
|
|
742
|
+
| ------ | ----------------------------------------------------------------------------- |
|
|
743
|
+
| `Bool` | `true` if the character is an ASCII whitespace character or `false` otherwise |
|
|
744
744
|
|
|
745
745
|
Examples:
|
|
746
746
|
|
|
@@ -775,15 +775,15 @@ Checks if the character is an ASCII punctuation character.
|
|
|
775
775
|
|
|
776
776
|
Parameters:
|
|
777
777
|
|
|
778
|
-
|param|type|description|
|
|
779
|
-
|
|
780
|
-
|
|
778
|
+
| param | type | description |
|
|
779
|
+
| ------ | ------ | ---------------------- |
|
|
780
|
+
| `char` | `Char` | The character to check |
|
|
781
781
|
|
|
782
782
|
Returns:
|
|
783
783
|
|
|
784
|
-
|type|description|
|
|
785
|
-
|
|
786
|
-
|
|
784
|
+
| type | description |
|
|
785
|
+
| ------ | ------------------------------------------------------------------------------ |
|
|
786
|
+
| `Bool` | `true` if the character is an ASCII punctuation character or `false` otherwise |
|
|
787
787
|
|
|
788
788
|
Examples:
|
|
789
789
|
|
|
@@ -810,15 +810,15 @@ Checks if the character is an ASCII graphic character.
|
|
|
810
810
|
|
|
811
811
|
Parameters:
|
|
812
812
|
|
|
813
|
-
|param|type|description|
|
|
814
|
-
|
|
815
|
-
|
|
813
|
+
| param | type | description |
|
|
814
|
+
| ------ | ------ | ---------------------- |
|
|
815
|
+
| `char` | `Char` | The character to check |
|
|
816
816
|
|
|
817
817
|
Returns:
|
|
818
818
|
|
|
819
|
-
|type|description|
|
|
820
|
-
|
|
821
|
-
|
|
819
|
+
| type | description |
|
|
820
|
+
| ------ | -------------------------------------------------------------------------- |
|
|
821
|
+
| `Bool` | `true` if the character is an ASCII graphic character or `false` otherwise |
|
|
822
822
|
|
|
823
823
|
Examples:
|
|
824
824
|
|
|
@@ -852,15 +852,15 @@ Converts the character to ASCII lowercase if it is an ASCII uppercase character.
|
|
|
852
852
|
|
|
853
853
|
Parameters:
|
|
854
854
|
|
|
855
|
-
|param|type|description|
|
|
856
|
-
|
|
857
|
-
|
|
855
|
+
| param | type | description |
|
|
856
|
+
| ------ | ------ | ------------------------ |
|
|
857
|
+
| `char` | `Char` | The character to convert |
|
|
858
858
|
|
|
859
859
|
Returns:
|
|
860
860
|
|
|
861
|
-
|type|description|
|
|
862
|
-
|
|
863
|
-
|
|
861
|
+
| type | description |
|
|
862
|
+
| ------ | ------------------------ |
|
|
863
|
+
| `Char` | The lowercased character |
|
|
864
864
|
|
|
865
865
|
Examples:
|
|
866
866
|
|
|
@@ -890,15 +890,15 @@ Converts the character to ASCII uppercase if it is an ASCII lowercase character.
|
|
|
890
890
|
|
|
891
891
|
Parameters:
|
|
892
892
|
|
|
893
|
-
|param|type|description|
|
|
894
|
-
|
|
895
|
-
|
|
893
|
+
| param | type | description |
|
|
894
|
+
| ------ | ------ | ------------------------ |
|
|
895
|
+
| `char` | `Char` | The character to convert |
|
|
896
896
|
|
|
897
897
|
Returns:
|
|
898
898
|
|
|
899
|
-
|type|description|
|
|
900
|
-
|
|
901
|
-
|
|
899
|
+
| type | description |
|
|
900
|
+
| ------ | ------------------------ |
|
|
901
|
+
| `Char` | The uppercased character |
|
|
902
902
|
|
|
903
903
|
Examples:
|
|
904
904
|
|
package/exception.md
CHANGED
|
@@ -45,9 +45,9 @@ used as the exception's string value.
|
|
|
45
45
|
|
|
46
46
|
Parameters:
|
|
47
47
|
|
|
48
|
-
|param|type|description|
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
| param | type | description |
|
|
49
|
+
| --------- | ----------------------------- | --------------------------------- |
|
|
50
|
+
| `printer` | `Exception => Option<String>` | The exception printer to register |
|
|
51
51
|
|
|
52
52
|
Examples:
|
|
53
53
|
|
|
@@ -80,13 +80,13 @@ Gets the string representation of the given exception.
|
|
|
80
80
|
|
|
81
81
|
Parameters:
|
|
82
82
|
|
|
83
|
-
|param|type|description|
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
| param | type | description |
|
|
84
|
+
| ----- | ----------- | -------------------------- |
|
|
85
|
+
| `e` | `Exception` | The exception to stringify |
|
|
86
86
|
|
|
87
87
|
Returns:
|
|
88
88
|
|
|
89
|
-
|type|description|
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
| type | description |
|
|
90
|
+
| -------- | ------------------------------------------ |
|
|
91
|
+
| `String` | The string representation of the exception |
|
|
92
92
|
|