@grain/stdlib 0.4.4 → 0.5.0

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 (97) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/LICENSE +1 -1
  3. package/array.gr +92 -73
  4. package/array.md +18 -18
  5. package/bigint.gr +497 -0
  6. package/bigint.md +811 -0
  7. package/buffer.gr +56 -217
  8. package/buffer.md +24 -17
  9. package/bytes.gr +103 -205
  10. package/bytes.md +19 -0
  11. package/char.gr +152 -166
  12. package/char.md +200 -0
  13. package/exception.md +6 -0
  14. package/float32.gr +159 -82
  15. package/float32.md +315 -0
  16. package/float64.gr +163 -82
  17. package/float64.md +315 -0
  18. package/hash.gr +53 -49
  19. package/int32.gr +479 -230
  20. package/int32.md +937 -0
  21. package/int64.gr +479 -230
  22. package/int64.md +937 -0
  23. package/list.gr +530 -116
  24. package/list.md +1141 -0
  25. package/map.gr +302 -121
  26. package/map.md +525 -0
  27. package/number.gr +51 -57
  28. package/number.md +37 -3
  29. package/option.gr +25 -25
  30. package/option.md +1 -1
  31. package/package.json +3 -3
  32. package/pervasives.gr +504 -52
  33. package/pervasives.md +1116 -0
  34. package/queue.gr +8 -1
  35. package/queue.md +10 -0
  36. package/random.gr +196 -0
  37. package/random.md +179 -0
  38. package/range.gr +26 -26
  39. package/regex.gr +1833 -842
  40. package/regex.md +11 -11
  41. package/result.md +1 -1
  42. package/runtime/bigint.gr +2045 -0
  43. package/runtime/bigint.md +326 -0
  44. package/runtime/dataStructures.gr +99 -279
  45. package/runtime/dataStructures.md +391 -0
  46. package/runtime/debug.gr +0 -1
  47. package/runtime/debug.md +6 -0
  48. package/runtime/equal.gr +40 -37
  49. package/runtime/equal.md +6 -0
  50. package/runtime/exception.gr +28 -15
  51. package/runtime/exception.md +30 -0
  52. package/runtime/gc.gr +50 -20
  53. package/runtime/gc.md +36 -0
  54. package/runtime/malloc.gr +32 -22
  55. package/runtime/malloc.md +55 -0
  56. package/runtime/numberUtils.gr +297 -142
  57. package/runtime/numberUtils.md +54 -0
  58. package/runtime/numbers.gr +1204 -453
  59. package/runtime/numbers.md +300 -0
  60. package/runtime/string.gr +193 -228
  61. package/runtime/string.md +24 -0
  62. package/runtime/stringUtils.gr +62 -38
  63. package/runtime/stringUtils.md +6 -0
  64. package/runtime/unsafe/constants.gr +17 -0
  65. package/runtime/unsafe/constants.md +72 -0
  66. package/runtime/unsafe/conv.gr +10 -10
  67. package/runtime/unsafe/conv.md +71 -0
  68. package/runtime/unsafe/errors.md +204 -0
  69. package/runtime/unsafe/memory.gr +14 -3
  70. package/runtime/unsafe/memory.md +54 -0
  71. package/runtime/unsafe/printWasm.gr +4 -4
  72. package/runtime/unsafe/printWasm.md +24 -0
  73. package/runtime/unsafe/tags.gr +11 -10
  74. package/runtime/unsafe/tags.md +120 -0
  75. package/runtime/unsafe/wasmf32.gr +9 -2
  76. package/runtime/unsafe/wasmf32.md +168 -0
  77. package/runtime/unsafe/wasmf64.gr +9 -2
  78. package/runtime/unsafe/wasmf64.md +168 -0
  79. package/runtime/unsafe/wasmi32.gr +65 -47
  80. package/runtime/unsafe/wasmi32.md +282 -0
  81. package/runtime/unsafe/wasmi64.gr +78 -50
  82. package/runtime/unsafe/wasmi64.md +300 -0
  83. package/runtime/utils/printing.gr +62 -0
  84. package/runtime/utils/printing.md +18 -0
  85. package/runtime/wasi.gr +200 -46
  86. package/runtime/wasi.md +839 -0
  87. package/set.gr +125 -121
  88. package/set.md +24 -21
  89. package/stack.gr +29 -29
  90. package/stack.md +4 -6
  91. package/string.gr +434 -415
  92. package/string.md +3 -3
  93. package/sys/file.gr +477 -482
  94. package/sys/process.gr +33 -47
  95. package/sys/random.gr +48 -20
  96. package/sys/random.md +38 -0
  97. package/sys/time.gr +12 -28
package/regex.md CHANGED
@@ -62,17 +62,17 @@ The special character sequences are as follows:
62
62
  - `(«re»)` - Matches `«re»`, storing the result in a group
63
63
  - `(?:«re»)` - Matches `«re»` without storing the result in a group
64
64
  - `(?«mode»:«re») - Matches `«re»` with the mode settings specified by `«mode»` using the following syntax:
65
- - `«mode»i` - The same as `«mode»`, but with case-insensitivity enabled (temporarily not supported until grain-lang/grain#661 is resolved)
66
- - `«mode»-i` - The same as `«mode»`, but with case-insensitivity disabled (the default)
67
- - `«mode»m` / `«mode»-s` - The same as `«mode»`, but with multi-line mode enabled
68
- - `«mode»-m` / `«mode»s` - The same as `«mode»`, but with multi-line mode disabled
69
- - An empty string, which will not change any mode settings
65
+ - `«mode»i` - The same as `«mode»`, but with case-insensitivity enabled (temporarily not supported until grain-lang/grain#661 is resolved)
66
+ - `«mode»-i` - The same as `«mode»`, but with case-insensitivity disabled (the default)
67
+ - `«mode»m` / `«mode»-s` - The same as `«mode»`, but with multi-line mode enabled
68
+ - `«mode»-m` / `«mode»s` - The same as `«mode»`, but with multi-line mode disabled
69
+ - An empty string, which will not change any mode settings
70
70
  - `(?«tst»«re1»|«re2»)` - Will match `«re1»` if `«tst»`, otherwise will match `«re2»`. The following options are available for `«tst»`
71
- - `(«n»)` - Will be true if group `«n»` has a match
72
- - `(?=«re»)` - Will be true if `«re»` matches the next sequence
73
- - `(?!«re»)` - Will be true if `«re»` does not match the next sequence
74
- - `(?<=«re»)` - Will be true if `«re»` matches the preceding sequence
75
- - `(?<!«re»)` - Will be true if `«re»` does not match the preceding sequence
71
+ - `(«n»)` - Will be true if group `«n»` has a match
72
+ - `(?=«re»)` - Will be true if `«re»` matches the next sequence
73
+ - `(?!«re»)` - Will be true if `«re»` does not match the next sequence
74
+ - `(?<=«re»)` - Will be true if `«re»` matches the preceding sequence
75
+ - `(?<!«re»)` - Will be true if `«re»` does not match the preceding sequence
76
76
  - `(?«tst»«re»)` - Equivalent to `(?«tst»«re»|)`
77
77
  - Finally, basic classes (defined below) can also appear outside of character ranges.
78
78
 
@@ -201,7 +201,7 @@ Returns:
201
201
 
202
202
  |type|description|
203
203
  |----|-----------|
204
- |`Bool`|`true` if the RegExp matches the string, otherwise `false`|
204
+ |`Bool`|`true` if the RegExp matches the string or `false` otherwise|
205
205
 
206
206
  Examples:
207
207
 
package/result.md CHANGED
@@ -272,7 +272,7 @@ No other changes yet.
272
272
  </details>
273
273
 
274
274
  ```grain
275
- ( or ) : (Result<a, b>, Result<a, b>) -> Result<a, b>
275
+ or : (Result<a, b>, Result<a, b>) -> Result<a, b>
276
276
  ```
277
277
 
278
278
  Behaves like a logical OR (`||`) where the first Result is only returned if it is the `Ok` variant and falling back to the second Result in all other cases.