@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.
- package/CHANGELOG.md +67 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/array.gr +55 -7
- package/array.md +606 -560
- package/bigint.md +228 -228
- package/buffer.gr +85 -53
- package/buffer.md +442 -319
- package/bytes.gr +112 -35
- package/bytes.md +299 -219
- package/char.gr +201 -99
- package/char.md +447 -120
- package/exception.gr +11 -11
- package/exception.md +29 -4
- package/float32.gr +327 -3
- package/float32.md +698 -111
- package/float64.gr +320 -3
- package/float64.md +698 -111
- package/fs.gr +1082 -0
- package/fs.md +630 -0
- package/hash.gr +142 -88
- package/hash.md +105 -17
- package/int16.md +178 -178
- package/int32.gr +26 -5
- package/int32.md +266 -231
- package/int64.gr +27 -2
- package/int64.md +266 -231
- package/int8.md +178 -178
- package/json.gr +366 -51
- package/json.md +431 -15
- package/list.gr +328 -31
- package/list.md +759 -336
- package/map.gr +20 -12
- package/map.md +266 -260
- package/marshal.gr +41 -40
- package/marshal.md +14 -14
- package/number.gr +278 -35
- package/number.md +688 -269
- package/option.md +162 -162
- package/package.json +5 -3
- package/path.gr +48 -0
- package/path.md +180 -89
- package/pervasives.gr +2 -2
- package/pervasives.md +275 -275
- package/priorityqueue.gr +7 -7
- package/priorityqueue.md +131 -131
- package/queue.gr +183 -29
- package/queue.md +404 -148
- package/random.md +43 -43
- package/range.gr +4 -4
- package/range.md +42 -42
- package/rational.md +123 -123
- package/regex.gr +52 -51
- package/regex.md +102 -102
- package/result.md +118 -118
- package/runtime/atof/common.md +39 -39
- package/runtime/atof/decimal.gr +6 -6
- package/runtime/atof/decimal.md +14 -14
- package/runtime/atof/lemire.gr +5 -5
- package/runtime/atof/lemire.md +1 -1
- package/runtime/atof/parse.gr +16 -16
- package/runtime/atof/parse.md +2 -2
- package/runtime/atof/slow.md +1 -1
- package/runtime/atof/table.md +2 -2
- package/runtime/atoi/parse.gr +3 -3
- package/runtime/atoi/parse.md +1 -1
- package/runtime/bigint.gr +15 -47
- package/runtime/bigint.md +54 -60
- package/runtime/compare.gr +2 -2
- package/runtime/compare.md +8 -8
- package/runtime/dataStructures.md +211 -211
- package/runtime/debugPrint.gr +4 -1
- package/runtime/debugPrint.md +9 -9
- package/runtime/equal.gr +99 -77
- package/runtime/equal.md +8 -8
- package/runtime/exception.gr +62 -82
- package/runtime/exception.md +62 -11
- package/runtime/gc.gr +39 -45
- package/runtime/gc.md +4 -4
- package/runtime/malloc.gr +7 -7
- package/runtime/malloc.md +13 -13
- package/runtime/math/kernel/cos.gr +70 -0
- package/runtime/math/kernel/cos.md +14 -0
- package/runtime/math/kernel/sin.gr +65 -0
- package/runtime/math/kernel/sin.md +14 -0
- package/runtime/math/kernel/tan.gr +136 -0
- package/runtime/math/kernel/tan.md +14 -0
- package/runtime/math/rempio2.gr +244 -0
- package/runtime/math/rempio2.md +14 -0
- package/runtime/math/trig.gr +130 -0
- package/runtime/math/trig.md +28 -0
- package/runtime/math/umuldi.gr +26 -0
- package/runtime/math/umuldi.md +14 -0
- package/runtime/numberUtils.gr +29 -29
- package/runtime/numberUtils.md +12 -12
- package/runtime/numbers.gr +373 -381
- package/runtime/numbers.md +348 -342
- package/runtime/string.gr +37 -105
- package/runtime/string.md +20 -26
- package/runtime/unsafe/constants.md +24 -24
- package/runtime/unsafe/conv.md +19 -19
- package/runtime/unsafe/memory.gr +24 -20
- package/runtime/unsafe/memory.md +27 -7
- package/runtime/unsafe/offsets.gr +36 -0
- package/runtime/unsafe/offsets.md +88 -0
- package/runtime/unsafe/panic.gr +28 -0
- package/runtime/unsafe/panic.md +14 -0
- package/runtime/unsafe/tags.md +32 -32
- package/runtime/unsafe/wasmf32.md +28 -28
- package/runtime/unsafe/wasmf64.md +28 -28
- package/runtime/unsafe/wasmi32.md +47 -47
- package/runtime/unsafe/wasmi64.md +50 -50
- package/runtime/utf8.gr +189 -0
- package/runtime/utf8.md +117 -0
- package/runtime/wasi.gr +4 -2
- package/runtime/wasi.md +147 -147
- package/set.gr +18 -11
- package/set.md +253 -247
- package/stack.gr +171 -2
- package/stack.md +371 -89
- package/string.gr +352 -557
- package/string.md +298 -255
- package/uint16.md +170 -170
- package/uint32.gr +25 -4
- package/uint32.md +249 -214
- package/uint64.gr +25 -5
- package/uint64.md +249 -214
- package/uint8.md +170 -170
- package/uri.gr +57 -53
- package/uri.md +88 -89
- package/wasi/file.gr +67 -59
- package/wasi/file.md +308 -308
- package/wasi/process.md +26 -26
- package/wasi/random.md +12 -12
- package/wasi/time.md +16 -16
- package/runtime/utils/printing.gr +0 -60
- package/runtime/utils/printing.md +0 -26
package/pervasives.md
CHANGED
|
@@ -25,7 +25,7 @@ No other changes yet.
|
|
|
25
25
|
</details>
|
|
26
26
|
|
|
27
27
|
```grain
|
|
28
|
-
(!)
|
|
28
|
+
(!): (bool: Bool) => Bool
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Computes the logical NOT (`!`) of the given operand.
|
|
@@ -33,15 +33,15 @@ Inverts the given Boolean value.
|
|
|
33
33
|
|
|
34
34
|
Parameters:
|
|
35
35
|
|
|
36
|
-
|param|type|description|
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
| param | type | description |
|
|
37
|
+
| ------ | ------ | ----------- |
|
|
38
|
+
| `bool` | `Bool` | The operand |
|
|
39
39
|
|
|
40
40
|
Returns:
|
|
41
41
|
|
|
42
|
-
|type|description|
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
| type | description |
|
|
43
|
+
| ------ | ------------------ |
|
|
44
|
+
| `Bool` | The inverted value |
|
|
45
45
|
|
|
46
46
|
Examples:
|
|
47
47
|
|
|
@@ -61,7 +61,7 @@ No other changes yet.
|
|
|
61
61
|
</details>
|
|
62
62
|
|
|
63
63
|
```grain
|
|
64
|
-
(&&)
|
|
64
|
+
(&&): (left: Bool, right: Bool) => Bool
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
Computes the logical AND (`&&`) of the given operands.
|
|
@@ -71,16 +71,16 @@ If the first operand is `true`, returns the value of the second operand.
|
|
|
71
71
|
|
|
72
72
|
Parameters:
|
|
73
73
|
|
|
74
|
-
|param|type|description|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
| param | type | description |
|
|
75
|
+
| ------- | ------ | ------------------ |
|
|
76
|
+
| `left` | `Bool` | The first operand |
|
|
77
|
+
| `right` | `Bool` | The second operand |
|
|
78
78
|
|
|
79
79
|
Returns:
|
|
80
80
|
|
|
81
|
-
|type|description|
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
| type | description |
|
|
82
|
+
| ------ | ------------------------------------------------------------------------------- |
|
|
83
|
+
| `Bool` | The first operand if it is `false` or the value of the second operand otherwise |
|
|
84
84
|
|
|
85
85
|
### Pervasives.**(||)**
|
|
86
86
|
|
|
@@ -90,7 +90,7 @@ No other changes yet.
|
|
|
90
90
|
</details>
|
|
91
91
|
|
|
92
92
|
```grain
|
|
93
|
-
(||)
|
|
93
|
+
(||): (left: Bool, right: Bool) => Bool
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Computes the logical OR `||` of the given operands.
|
|
@@ -100,16 +100,16 @@ If the first operand is `false`, returns the value of the second operand.
|
|
|
100
100
|
|
|
101
101
|
Parameters:
|
|
102
102
|
|
|
103
|
-
|param|type|description|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
| param | type | description |
|
|
104
|
+
| ------- | ------ | ------------------ |
|
|
105
|
+
| `left` | `Bool` | The first operand |
|
|
106
|
+
| `right` | `Bool` | The second operand |
|
|
107
107
|
|
|
108
108
|
Returns:
|
|
109
109
|
|
|
110
|
-
|type|description|
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
| type | description |
|
|
111
|
+
| ------ | ------------------------------------------------------------------------------ |
|
|
112
|
+
| `Bool` | The first operand if it is `true` or the value of the second operand otherwise |
|
|
113
113
|
|
|
114
114
|
### Pervasives.**(==)**
|
|
115
115
|
|
|
@@ -119,7 +119,7 @@ No other changes yet.
|
|
|
119
119
|
</details>
|
|
120
120
|
|
|
121
121
|
```grain
|
|
122
|
-
(==)
|
|
122
|
+
(==): (value1: a, value2: a) => Bool
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
Check that two values are equal. This checks for structural equality,
|
|
@@ -127,16 +127,16 @@ so it also works for comparing things like tuples and lists.
|
|
|
127
127
|
|
|
128
128
|
Parameters:
|
|
129
129
|
|
|
130
|
-
|param|type|description|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
| param | type | description |
|
|
131
|
+
| -------- | ---- | ------------------ |
|
|
132
|
+
| `value1` | `a` | The first operand |
|
|
133
|
+
| `value2` | `a` | The second operand |
|
|
134
134
|
|
|
135
135
|
Returns:
|
|
136
136
|
|
|
137
|
-
|type|description|
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
| type | description |
|
|
138
|
+
| ------ | ---------------------------------------------------------------- |
|
|
139
|
+
| `Bool` | `true` if the values are structurally equal or `false` otherwise |
|
|
140
140
|
|
|
141
141
|
### Pervasives.**(!=)**
|
|
142
142
|
|
|
@@ -146,7 +146,7 @@ No other changes yet.
|
|
|
146
146
|
</details>
|
|
147
147
|
|
|
148
148
|
```grain
|
|
149
|
-
(!=)
|
|
149
|
+
(!=): (value1: a, value2: a) => Bool
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
Check that two values are **not** equal. This checks for structural equality,
|
|
@@ -154,16 +154,16 @@ so it also works for comparing things like tuples and lists.
|
|
|
154
154
|
|
|
155
155
|
Parameters:
|
|
156
156
|
|
|
157
|
-
|param|type|description|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
| param | type | description |
|
|
158
|
+
| -------- | ---- | ------------------ |
|
|
159
|
+
| `value1` | `a` | The first operand |
|
|
160
|
+
| `value2` | `a` | The second operand |
|
|
161
161
|
|
|
162
162
|
Returns:
|
|
163
163
|
|
|
164
|
-
|type|description|
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
| type | description |
|
|
165
|
+
| ------ | ---------------------------------------------------------------- |
|
|
166
|
+
| `Bool` | `false` if the values are structurally equal or `true` otherwise |
|
|
167
167
|
|
|
168
168
|
### Pervasives.**is**
|
|
169
169
|
|
|
@@ -173,7 +173,7 @@ No other changes yet.
|
|
|
173
173
|
</details>
|
|
174
174
|
|
|
175
175
|
```grain
|
|
176
|
-
is
|
|
176
|
+
is: (left: a, right: a) => Bool
|
|
177
177
|
```
|
|
178
178
|
|
|
179
179
|
Checks that two values are physically equal.
|
|
@@ -181,16 +181,16 @@ Use this operator if you don’t need or want structural equality.
|
|
|
181
181
|
|
|
182
182
|
Parameters:
|
|
183
183
|
|
|
184
|
-
|param|type|description|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
| param | type | description |
|
|
185
|
+
| ------- | ---- | ------------------ |
|
|
186
|
+
| `left` | `a` | The first operand |
|
|
187
|
+
| `right` | `a` | The second operand |
|
|
188
188
|
|
|
189
189
|
Returns:
|
|
190
190
|
|
|
191
|
-
|type|description|
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
| type | description |
|
|
192
|
+
| ------ | -------------------------------------------------------------- |
|
|
193
|
+
| `Bool` | `true` if the values are physically equal or `false` otherwise |
|
|
194
194
|
|
|
195
195
|
### Pervasives.**isnt**
|
|
196
196
|
|
|
@@ -200,7 +200,7 @@ No other changes yet.
|
|
|
200
200
|
</details>
|
|
201
201
|
|
|
202
202
|
```grain
|
|
203
|
-
isnt
|
|
203
|
+
isnt: (value1: a, value2: a) => Bool
|
|
204
204
|
```
|
|
205
205
|
|
|
206
206
|
Checks that two values are **not** physically equal.
|
|
@@ -208,16 +208,16 @@ Use this operator if you don’t need or want structural equality.
|
|
|
208
208
|
|
|
209
209
|
Parameters:
|
|
210
210
|
|
|
211
|
-
|param|type|description|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
| param | type | description |
|
|
212
|
+
| -------- | ---- | ------------------ |
|
|
213
|
+
| `value1` | `a` | The first operand |
|
|
214
|
+
| `value2` | `a` | The second operand |
|
|
215
215
|
|
|
216
216
|
Returns:
|
|
217
217
|
|
|
218
|
-
|type|description|
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
| type | description |
|
|
219
|
+
| ------ | -------------------------------------------------------------- |
|
|
220
|
+
| `Bool` | `false` if the values are physically equal or `true` otherwise |
|
|
221
221
|
|
|
222
222
|
### Pervasives.**(<)**
|
|
223
223
|
|
|
@@ -227,23 +227,23 @@ No other changes yet.
|
|
|
227
227
|
</details>
|
|
228
228
|
|
|
229
229
|
```grain
|
|
230
|
-
(<)
|
|
230
|
+
(<): (num1: Number, num2: Number) => Bool
|
|
231
231
|
```
|
|
232
232
|
|
|
233
233
|
Checks if the first operand is less than the second operand.
|
|
234
234
|
|
|
235
235
|
Parameters:
|
|
236
236
|
|
|
237
|
-
|param|type|description|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
| param | type | description |
|
|
238
|
+
| ------ | -------- | ------------------ |
|
|
239
|
+
| `num1` | `Number` | The first operand |
|
|
240
|
+
| `num2` | `Number` | The second operand |
|
|
241
241
|
|
|
242
242
|
Returns:
|
|
243
243
|
|
|
244
|
-
|type|description|
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
| type | description |
|
|
245
|
+
| ------ | -------------------------------------------------------------------------------- |
|
|
246
|
+
| `Bool` | `true` if the first operand is less than the second operand or `false` otherwise |
|
|
247
247
|
|
|
248
248
|
### Pervasives.**(>)**
|
|
249
249
|
|
|
@@ -253,23 +253,23 @@ No other changes yet.
|
|
|
253
253
|
</details>
|
|
254
254
|
|
|
255
255
|
```grain
|
|
256
|
-
(>)
|
|
256
|
+
(>): (num1: Number, num2: Number) => Bool
|
|
257
257
|
```
|
|
258
258
|
|
|
259
259
|
Checks if the first operand is greater than the second operand.
|
|
260
260
|
|
|
261
261
|
Parameters:
|
|
262
262
|
|
|
263
|
-
|param|type|description|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
| param | type | description |
|
|
264
|
+
| ------ | -------- | ------------------ |
|
|
265
|
+
| `num1` | `Number` | The first operand |
|
|
266
|
+
| `num2` | `Number` | The second operand |
|
|
267
267
|
|
|
268
268
|
Returns:
|
|
269
269
|
|
|
270
|
-
|type|description|
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
| type | description |
|
|
271
|
+
| ------ | ----------------------------------------------------------------------------------- |
|
|
272
|
+
| `Bool` | `true` if the first operand is greater than the second operand or `false` otherwise |
|
|
273
273
|
|
|
274
274
|
### Pervasives.**(<=)**
|
|
275
275
|
|
|
@@ -279,23 +279,23 @@ No other changes yet.
|
|
|
279
279
|
</details>
|
|
280
280
|
|
|
281
281
|
```grain
|
|
282
|
-
(<=)
|
|
282
|
+
(<=): (num1: Number, num2: Number) => Bool
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
Checks if the first operand is less than or equal to the second operand.
|
|
286
286
|
|
|
287
287
|
Parameters:
|
|
288
288
|
|
|
289
|
-
|param|type|description|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
| param | type | description |
|
|
290
|
+
| ------ | -------- | ------------------ |
|
|
291
|
+
| `num1` | `Number` | The first operand |
|
|
292
|
+
| `num2` | `Number` | The second operand |
|
|
293
293
|
|
|
294
294
|
Returns:
|
|
295
295
|
|
|
296
|
-
|type|description|
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
| type | description |
|
|
297
|
+
| ------ | -------------------------------------------------------------------------------------------- |
|
|
298
|
+
| `Bool` | `true` if the first operand is less than or equal to the second operand or `false` otherwise |
|
|
299
299
|
|
|
300
300
|
### Pervasives.**(>=)**
|
|
301
301
|
|
|
@@ -305,23 +305,23 @@ No other changes yet.
|
|
|
305
305
|
</details>
|
|
306
306
|
|
|
307
307
|
```grain
|
|
308
|
-
(>=)
|
|
308
|
+
(>=): (num1: Number, num2: Number) => Bool
|
|
309
309
|
```
|
|
310
310
|
|
|
311
311
|
Checks if the first operand is greater than or equal to the second operand.
|
|
312
312
|
|
|
313
313
|
Parameters:
|
|
314
314
|
|
|
315
|
-
|param|type|description|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
315
|
+
| param | type | description |
|
|
316
|
+
| ------ | -------- | ------------------ |
|
|
317
|
+
| `num1` | `Number` | The first operand |
|
|
318
|
+
| `num2` | `Number` | The second operand |
|
|
319
319
|
|
|
320
320
|
Returns:
|
|
321
321
|
|
|
322
|
-
|type|description|
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
| type | description |
|
|
323
|
+
| ------ | ----------------------------------------------------------------------------------------------- |
|
|
324
|
+
| `Bool` | `true` if the first operand is greater than or equal to the second operand or `false` otherwise |
|
|
325
325
|
|
|
326
326
|
### Pervasives.**compare**
|
|
327
327
|
|
|
@@ -331,7 +331,7 @@ No other changes yet.
|
|
|
331
331
|
</details>
|
|
332
332
|
|
|
333
333
|
```grain
|
|
334
|
-
compare
|
|
334
|
+
compare: (num1: a, num2: a) => Number
|
|
335
335
|
```
|
|
336
336
|
|
|
337
337
|
Compares the first argument to the second argument and produces an integer result.
|
|
@@ -340,16 +340,16 @@ Provides a consistent ordering over all types and is suitable for sorting and ot
|
|
|
340
340
|
|
|
341
341
|
Parameters:
|
|
342
342
|
|
|
343
|
-
|param|type|description|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
| param | type | description |
|
|
344
|
+
| ------ | ---- | ------------------ |
|
|
345
|
+
| `num1` | `a` | The first operand |
|
|
346
|
+
| `num2` | `a` | The second operand |
|
|
347
347
|
|
|
348
348
|
Returns:
|
|
349
349
|
|
|
350
|
-
|type|description|
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
| type | description |
|
|
351
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
352
|
+
| `Number` | A negative integer if the first operand is less than the second operand, `0` if they are equal, or a positive integer otherwise |
|
|
353
353
|
|
|
354
354
|
### Pervasives.**(+)**
|
|
355
355
|
|
|
@@ -359,23 +359,23 @@ No other changes yet.
|
|
|
359
359
|
</details>
|
|
360
360
|
|
|
361
361
|
```grain
|
|
362
|
-
(+)
|
|
362
|
+
(+): (num1: Number, num2: Number) => Number
|
|
363
363
|
```
|
|
364
364
|
|
|
365
365
|
Computes the sum of its operands.
|
|
366
366
|
|
|
367
367
|
Parameters:
|
|
368
368
|
|
|
369
|
-
|param|type|description|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
369
|
+
| param | type | description |
|
|
370
|
+
| ------ | -------- | ------------------ |
|
|
371
|
+
| `num1` | `Number` | The first operand |
|
|
372
|
+
| `num2` | `Number` | The second operand |
|
|
373
373
|
|
|
374
374
|
Returns:
|
|
375
375
|
|
|
376
|
-
|type|description|
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
| type | description |
|
|
377
|
+
| -------- | --------------------------- |
|
|
378
|
+
| `Number` | The sum of the two operands |
|
|
379
379
|
|
|
380
380
|
### Pervasives.**(-)**
|
|
381
381
|
|
|
@@ -385,23 +385,23 @@ No other changes yet.
|
|
|
385
385
|
</details>
|
|
386
386
|
|
|
387
387
|
```grain
|
|
388
|
-
(-)
|
|
388
|
+
(-): (num1: Number, num2: Number) => Number
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
Computes the difference of its operands.
|
|
392
392
|
|
|
393
393
|
Parameters:
|
|
394
394
|
|
|
395
|
-
|param|type|description|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
395
|
+
| param | type | description |
|
|
396
|
+
| ------ | -------- | ------------------ |
|
|
397
|
+
| `num1` | `Number` | The first operand |
|
|
398
|
+
| `num2` | `Number` | The second operand |
|
|
399
399
|
|
|
400
400
|
Returns:
|
|
401
401
|
|
|
402
|
-
|type|description|
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
| type | description |
|
|
403
|
+
| -------- | ---------------------------------- |
|
|
404
|
+
| `Number` | The difference of the two operands |
|
|
405
405
|
|
|
406
406
|
### Pervasives.**(*)**
|
|
407
407
|
|
|
@@ -411,23 +411,23 @@ No other changes yet.
|
|
|
411
411
|
</details>
|
|
412
412
|
|
|
413
413
|
```grain
|
|
414
|
-
(*)
|
|
414
|
+
(*): (num1: Number, num2: Number) => Number
|
|
415
415
|
```
|
|
416
416
|
|
|
417
417
|
Computes the product of its operands.
|
|
418
418
|
|
|
419
419
|
Parameters:
|
|
420
420
|
|
|
421
|
-
|param|type|description|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
421
|
+
| param | type | description |
|
|
422
|
+
| ------ | -------- | ------------------ |
|
|
423
|
+
| `num1` | `Number` | The first operand |
|
|
424
|
+
| `num2` | `Number` | The second operand |
|
|
425
425
|
|
|
426
426
|
Returns:
|
|
427
427
|
|
|
428
|
-
|type|description|
|
|
429
|
-
|
|
430
|
-
|
|
428
|
+
| type | description |
|
|
429
|
+
| -------- | ------------------------------- |
|
|
430
|
+
| `Number` | The product of the two operands |
|
|
431
431
|
|
|
432
432
|
### Pervasives.**(/)**
|
|
433
433
|
|
|
@@ -437,23 +437,23 @@ No other changes yet.
|
|
|
437
437
|
</details>
|
|
438
438
|
|
|
439
439
|
```grain
|
|
440
|
-
(/)
|
|
440
|
+
(/): (num1: Number, num2: Number) => Number
|
|
441
441
|
```
|
|
442
442
|
|
|
443
443
|
Computes the quotient of its operands.
|
|
444
444
|
|
|
445
445
|
Parameters:
|
|
446
446
|
|
|
447
|
-
|param|type|description|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
447
|
+
| param | type | description |
|
|
448
|
+
| ------ | -------- | ------------------ |
|
|
449
|
+
| `num1` | `Number` | The first operand |
|
|
450
|
+
| `num2` | `Number` | The second operand |
|
|
451
451
|
|
|
452
452
|
Returns:
|
|
453
453
|
|
|
454
|
-
|type|description|
|
|
455
|
-
|
|
456
|
-
|
|
454
|
+
| type | description |
|
|
455
|
+
| -------- | -------------------------------- |
|
|
456
|
+
| `Number` | The quotient of the two operands |
|
|
457
457
|
|
|
458
458
|
### Pervasives.**(%)**
|
|
459
459
|
|
|
@@ -463,7 +463,7 @@ No other changes yet.
|
|
|
463
463
|
</details>
|
|
464
464
|
|
|
465
465
|
```grain
|
|
466
|
-
(%)
|
|
466
|
+
(%): (num1: Number, num2: Number) => Number
|
|
467
467
|
```
|
|
468
468
|
|
|
469
469
|
Computes the remainder of the division of the first operand by the second.
|
|
@@ -471,16 +471,16 @@ The result will have the sign of the second operand.
|
|
|
471
471
|
|
|
472
472
|
Parameters:
|
|
473
473
|
|
|
474
|
-
|param|type|description|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
474
|
+
| param | type | description |
|
|
475
|
+
| ------ | -------- | ------------------ |
|
|
476
|
+
| `num1` | `Number` | The first operand |
|
|
477
|
+
| `num2` | `Number` | The second operand |
|
|
478
478
|
|
|
479
479
|
Returns:
|
|
480
480
|
|
|
481
|
-
|type|description|
|
|
482
|
-
|
|
483
|
-
|
|
481
|
+
| type | description |
|
|
482
|
+
| -------- | --------------------------- |
|
|
483
|
+
| `Number` | The modulus of its operands |
|
|
484
484
|
|
|
485
485
|
### Pervasives.**(\*\*)**
|
|
486
486
|
|
|
@@ -497,23 +497,23 @@ Returns:
|
|
|
497
497
|
</details>
|
|
498
498
|
|
|
499
499
|
```grain
|
|
500
|
-
(**)
|
|
500
|
+
(**): (base: Number, power: Number) => Number
|
|
501
501
|
```
|
|
502
502
|
|
|
503
503
|
Computes the exponentiation of the given base and power.
|
|
504
504
|
|
|
505
505
|
Parameters:
|
|
506
506
|
|
|
507
|
-
|param|type|description|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
| param | type | description |
|
|
508
|
+
| ------- | -------- | ------------------- |
|
|
509
|
+
| `base` | `Number` | The base number |
|
|
510
|
+
| `power` | `Number` | The exponent number |
|
|
511
511
|
|
|
512
512
|
Returns:
|
|
513
513
|
|
|
514
|
-
|type|description|
|
|
515
|
-
|
|
516
|
-
|
|
514
|
+
| type | description |
|
|
515
|
+
| -------- | ---------------------------------- |
|
|
516
|
+
| `Number` | The base raised to the given power |
|
|
517
517
|
|
|
518
518
|
### Pervasives.**incr**
|
|
519
519
|
|
|
@@ -523,22 +523,22 @@ No other changes yet.
|
|
|
523
523
|
</details>
|
|
524
524
|
|
|
525
525
|
```grain
|
|
526
|
-
incr
|
|
526
|
+
incr: (value: Number) => Number
|
|
527
527
|
```
|
|
528
528
|
|
|
529
529
|
Increments the value by one.
|
|
530
530
|
|
|
531
531
|
Parameters:
|
|
532
532
|
|
|
533
|
-
|param|type|description|
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
| param | type | description |
|
|
534
|
+
| ------- | -------- | ---------------------- |
|
|
535
|
+
| `value` | `Number` | The value to increment |
|
|
536
536
|
|
|
537
537
|
Returns:
|
|
538
538
|
|
|
539
|
-
|type|description|
|
|
540
|
-
|
|
541
|
-
|
|
539
|
+
| type | description |
|
|
540
|
+
| -------- | --------------------- |
|
|
541
|
+
| `Number` | The incremented value |
|
|
542
542
|
|
|
543
543
|
### Pervasives.**decr**
|
|
544
544
|
|
|
@@ -548,22 +548,22 @@ No other changes yet.
|
|
|
548
548
|
</details>
|
|
549
549
|
|
|
550
550
|
```grain
|
|
551
|
-
decr
|
|
551
|
+
decr: (value: Number) => Number
|
|
552
552
|
```
|
|
553
553
|
|
|
554
554
|
Decrements the value by one.
|
|
555
555
|
|
|
556
556
|
Parameters:
|
|
557
557
|
|
|
558
|
-
|param|type|description|
|
|
559
|
-
|
|
560
|
-
|
|
558
|
+
| param | type | description |
|
|
559
|
+
| ------- | -------- | ---------------------- |
|
|
560
|
+
| `value` | `Number` | The value to decrement |
|
|
561
561
|
|
|
562
562
|
Returns:
|
|
563
563
|
|
|
564
|
-
|type|description|
|
|
565
|
-
|
|
566
|
-
|
|
564
|
+
| type | description |
|
|
565
|
+
| -------- | --------------------- |
|
|
566
|
+
| `Number` | The decremented value |
|
|
567
567
|
|
|
568
568
|
### Pervasives.**(++)**
|
|
569
569
|
|
|
@@ -573,23 +573,23 @@ No other changes yet.
|
|
|
573
573
|
</details>
|
|
574
574
|
|
|
575
575
|
```grain
|
|
576
|
-
(++)
|
|
576
|
+
(++): (str1: String, str2: String) => String
|
|
577
577
|
```
|
|
578
578
|
|
|
579
579
|
Concatenate two strings.
|
|
580
580
|
|
|
581
581
|
Parameters:
|
|
582
582
|
|
|
583
|
-
|param|type|description|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
583
|
+
| param | type | description |
|
|
584
|
+
| ------ | -------- | -------------------- |
|
|
585
|
+
| `str1` | `String` | The beginning string |
|
|
586
|
+
| `str2` | `String` | The ending string |
|
|
587
587
|
|
|
588
588
|
Returns:
|
|
589
589
|
|
|
590
|
-
|type|description|
|
|
591
|
-
|
|
592
|
-
|
|
590
|
+
| type | description |
|
|
591
|
+
| -------- | ------------------- |
|
|
592
|
+
| `String` | The combined string |
|
|
593
593
|
|
|
594
594
|
Examples:
|
|
595
595
|
|
|
@@ -605,22 +605,22 @@ No other changes yet.
|
|
|
605
605
|
</details>
|
|
606
606
|
|
|
607
607
|
```grain
|
|
608
|
-
lnot
|
|
608
|
+
lnot: (value: Number) => Number
|
|
609
609
|
```
|
|
610
610
|
|
|
611
611
|
Computes the bitwise NOT of the operand.
|
|
612
612
|
|
|
613
613
|
Parameters:
|
|
614
614
|
|
|
615
|
-
|param|type|description|
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
| param | type | description |
|
|
616
|
+
| ------- | -------- | ----------- |
|
|
617
|
+
| `value` | `Number` | The operand |
|
|
618
618
|
|
|
619
619
|
Returns:
|
|
620
620
|
|
|
621
|
-
|type|description|
|
|
622
|
-
|
|
623
|
-
|
|
621
|
+
| type | description |
|
|
622
|
+
| -------- | ------------------------------------------- |
|
|
623
|
+
| `Number` | Containing the inverted bits of the operand |
|
|
624
624
|
|
|
625
625
|
### Pervasives.**(&)**
|
|
626
626
|
|
|
@@ -638,23 +638,23 @@ Returns:
|
|
|
638
638
|
</details>
|
|
639
639
|
|
|
640
640
|
```grain
|
|
641
|
-
(&)
|
|
641
|
+
(&): (value1: Number, value2: Number) => Number
|
|
642
642
|
```
|
|
643
643
|
|
|
644
644
|
Computes the bitwise AND (`&`) on the given operands.
|
|
645
645
|
|
|
646
646
|
Parameters:
|
|
647
647
|
|
|
648
|
-
|param|type|description|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
648
|
+
| param | type | description |
|
|
649
|
+
| -------- | -------- | ------------------ |
|
|
650
|
+
| `value1` | `Number` | The first operand |
|
|
651
|
+
| `value2` | `Number` | The second operand |
|
|
652
652
|
|
|
653
653
|
Returns:
|
|
654
654
|
|
|
655
|
-
|type|description|
|
|
656
|
-
|
|
657
|
-
|
|
655
|
+
| type | description |
|
|
656
|
+
| -------- | ----------------------------------------------------------------------------------------------- |
|
|
657
|
+
| `Number` | Containing a `1` in each bit position for which the corresponding bits of both operands are `1` |
|
|
658
658
|
|
|
659
659
|
### Pervasives.**(|)**
|
|
660
660
|
|
|
@@ -672,23 +672,23 @@ Returns:
|
|
|
672
672
|
</details>
|
|
673
673
|
|
|
674
674
|
```grain
|
|
675
|
-
(|)
|
|
675
|
+
(|): (value1: Number, value2: Number) => Number
|
|
676
676
|
```
|
|
677
677
|
|
|
678
678
|
Computes the bitwise OR (`|`) on the given operands.
|
|
679
679
|
|
|
680
680
|
Parameters:
|
|
681
681
|
|
|
682
|
-
|param|type|description|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
682
|
+
| param | type | description |
|
|
683
|
+
| -------- | -------- | ------------------ |
|
|
684
|
+
| `value1` | `Number` | The first operand |
|
|
685
|
+
| `value2` | `Number` | The second operand |
|
|
686
686
|
|
|
687
687
|
Returns:
|
|
688
688
|
|
|
689
|
-
|type|description|
|
|
690
|
-
|
|
691
|
-
|
|
689
|
+
| type | description |
|
|
690
|
+
| -------- | --------------------------------------------------------------------------------------------------------- |
|
|
691
|
+
| `Number` | Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1` |
|
|
692
692
|
|
|
693
693
|
### Pervasives.**(^)**
|
|
694
694
|
|
|
@@ -707,23 +707,23 @@ Returns:
|
|
|
707
707
|
</details>
|
|
708
708
|
|
|
709
709
|
```grain
|
|
710
|
-
(^)
|
|
710
|
+
(^): (value1: Number, value2: Number) => Number
|
|
711
711
|
```
|
|
712
712
|
|
|
713
713
|
Computes the bitwise XOR (`^`) on the given operands.
|
|
714
714
|
|
|
715
715
|
Parameters:
|
|
716
716
|
|
|
717
|
-
|param|type|description|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
717
|
+
| param | type | description |
|
|
718
|
+
| -------- | -------- | ------------------ |
|
|
719
|
+
| `value1` | `Number` | The first operand |
|
|
720
|
+
| `value2` | `Number` | The second operand |
|
|
721
721
|
|
|
722
722
|
Returns:
|
|
723
723
|
|
|
724
|
-
|type|description|
|
|
725
|
-
|
|
726
|
-
|
|
724
|
+
| type | description |
|
|
725
|
+
| -------- | -------------------------------------------------------------------------------------------------------------- |
|
|
726
|
+
| `Number` | Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1` |
|
|
727
727
|
|
|
728
728
|
### Pervasives.**(<<)**
|
|
729
729
|
|
|
@@ -741,23 +741,23 @@ Returns:
|
|
|
741
741
|
</details>
|
|
742
742
|
|
|
743
743
|
```grain
|
|
744
|
-
(<<)
|
|
744
|
+
(<<): (value: Number, amount: Number) => Number
|
|
745
745
|
```
|
|
746
746
|
|
|
747
747
|
Shifts the bits of the value left by the given number of bits.
|
|
748
748
|
|
|
749
749
|
Parameters:
|
|
750
750
|
|
|
751
|
-
|param|type|description|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
751
|
+
| param | type | description |
|
|
752
|
+
| -------- | -------- | ------------------------------ |
|
|
753
|
+
| `value` | `Number` | The value to shift |
|
|
754
|
+
| `amount` | `Number` | The number of bits to shift by |
|
|
755
755
|
|
|
756
756
|
Returns:
|
|
757
757
|
|
|
758
|
-
|type|description|
|
|
759
|
-
|
|
760
|
-
|
|
758
|
+
| type | description |
|
|
759
|
+
| -------- | ----------------- |
|
|
760
|
+
| `Number` | The shifted value |
|
|
761
761
|
|
|
762
762
|
### Pervasives.**(>>>)**
|
|
763
763
|
|
|
@@ -775,23 +775,23 @@ Returns:
|
|
|
775
775
|
</details>
|
|
776
776
|
|
|
777
777
|
```grain
|
|
778
|
-
(>>>)
|
|
778
|
+
(>>>): (value: Number, amount: Number) => Number
|
|
779
779
|
```
|
|
780
780
|
|
|
781
781
|
Shifts the bits of the value right by the given number of bits, preserving the sign bit.
|
|
782
782
|
|
|
783
783
|
Parameters:
|
|
784
784
|
|
|
785
|
-
|param|type|description|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
785
|
+
| param | type | description |
|
|
786
|
+
| -------- | -------- | ---------------------- |
|
|
787
|
+
| `value` | `Number` | The value to shift |
|
|
788
|
+
| `amount` | `Number` | The amount to shift by |
|
|
789
789
|
|
|
790
790
|
Returns:
|
|
791
791
|
|
|
792
|
-
|type|description|
|
|
793
|
-
|
|
794
|
-
|
|
792
|
+
| type | description |
|
|
793
|
+
| -------- | ----------------- |
|
|
794
|
+
| `Number` | The shifted value |
|
|
795
795
|
|
|
796
796
|
### Pervasives.**(>>)**
|
|
797
797
|
|
|
@@ -809,23 +809,23 @@ Returns:
|
|
|
809
809
|
</details>
|
|
810
810
|
|
|
811
811
|
```grain
|
|
812
|
-
(>>)
|
|
812
|
+
(>>): (value: Number, amount: Number) => Number
|
|
813
813
|
```
|
|
814
814
|
|
|
815
815
|
Shifts the bits of the value right by the given number of bits.
|
|
816
816
|
|
|
817
817
|
Parameters:
|
|
818
818
|
|
|
819
|
-
|param|type|description|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
819
|
+
| param | type | description |
|
|
820
|
+
| -------- | -------- | ---------------------- |
|
|
821
|
+
| `value` | `Number` | The value to shift |
|
|
822
|
+
| `amount` | `Number` | The amount to shift by |
|
|
823
823
|
|
|
824
824
|
Returns:
|
|
825
825
|
|
|
826
|
-
|type|description|
|
|
827
|
-
|
|
828
|
-
|
|
826
|
+
| type | description |
|
|
827
|
+
| -------- | ----------------- |
|
|
828
|
+
| `Number` | The shifted value |
|
|
829
829
|
|
|
830
830
|
### Pervasives.**toString**
|
|
831
831
|
|
|
@@ -835,7 +835,7 @@ No other changes yet.
|
|
|
835
835
|
</details>
|
|
836
836
|
|
|
837
837
|
```grain
|
|
838
|
-
toString
|
|
838
|
+
toString: (value: a) => String
|
|
839
839
|
```
|
|
840
840
|
|
|
841
841
|
Converts the given operand to a string.
|
|
@@ -843,15 +843,15 @@ Provides a better representation of data types if those types are provided from
|
|
|
843
843
|
|
|
844
844
|
Parameters:
|
|
845
845
|
|
|
846
|
-
|param|type|description|
|
|
847
|
-
|
|
848
|
-
|
|
846
|
+
| param | type | description |
|
|
847
|
+
| ------- | ---- | ----------- |
|
|
848
|
+
| `value` | `a` | The operand |
|
|
849
849
|
|
|
850
850
|
Returns:
|
|
851
851
|
|
|
852
|
-
|type|description|
|
|
853
|
-
|
|
854
|
-
|
|
852
|
+
| type | description |
|
|
853
|
+
| -------- | ------------------------ |
|
|
854
|
+
| `String` | The operand, as a string |
|
|
855
855
|
|
|
856
856
|
### Pervasives.**print**
|
|
857
857
|
|
|
@@ -868,7 +868,7 @@ Returns:
|
|
|
868
868
|
</details>
|
|
869
869
|
|
|
870
870
|
```grain
|
|
871
|
-
print
|
|
871
|
+
print: (value: a, ?suffix: String) => Void
|
|
872
872
|
```
|
|
873
873
|
|
|
874
874
|
Prints the given operand to the console. Works for any type. Internally, calls `toString`
|
|
@@ -877,10 +877,10 @@ are provided from the module.
|
|
|
877
877
|
|
|
878
878
|
Parameters:
|
|
879
879
|
|
|
880
|
-
|param|type|description|
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
880
|
+
| param | type | description |
|
|
881
|
+
| --------- | -------- | -------------------------------------- |
|
|
882
|
+
| `value` | `a` | The operand |
|
|
883
|
+
| `?suffix` | `String` | The string to print after the argument |
|
|
884
884
|
|
|
885
885
|
### Pervasives.**ignore**
|
|
886
886
|
|
|
@@ -890,16 +890,16 @@ No other changes yet.
|
|
|
890
890
|
</details>
|
|
891
891
|
|
|
892
892
|
```grain
|
|
893
|
-
ignore
|
|
893
|
+
ignore: (value: a) => Void
|
|
894
894
|
```
|
|
895
895
|
|
|
896
896
|
Accepts any value and always returns `void`.
|
|
897
897
|
|
|
898
898
|
Parameters:
|
|
899
899
|
|
|
900
|
-
|param|type|description|
|
|
901
|
-
|
|
902
|
-
|
|
900
|
+
| param | type | description |
|
|
901
|
+
| ------- | ---- | ------------------- |
|
|
902
|
+
| `value` | `a` | The value to ignore |
|
|
903
903
|
|
|
904
904
|
### Pervasives.**assert**
|
|
905
905
|
|
|
@@ -909,16 +909,16 @@ No other changes yet.
|
|
|
909
909
|
</details>
|
|
910
910
|
|
|
911
911
|
```grain
|
|
912
|
-
assert
|
|
912
|
+
assert: (condition: Bool) => Void
|
|
913
913
|
```
|
|
914
914
|
|
|
915
915
|
Assert that the given Boolean condition is `true`.
|
|
916
916
|
|
|
917
917
|
Parameters:
|
|
918
918
|
|
|
919
|
-
|param|type|description|
|
|
920
|
-
|
|
921
|
-
|
|
919
|
+
| param | type | description |
|
|
920
|
+
| ----------- | ------ | ----------------------- |
|
|
921
|
+
| `condition` | `Bool` | The condition to assert |
|
|
922
922
|
|
|
923
923
|
Throws:
|
|
924
924
|
|
|
@@ -944,27 +944,27 @@ No other changes yet.
|
|
|
944
944
|
</details>
|
|
945
945
|
|
|
946
946
|
```grain
|
|
947
|
-
throw
|
|
947
|
+
throw: (exn: Exception) => a
|
|
948
948
|
```
|
|
949
949
|
|
|
950
950
|
Throw an exception. Currently, exceptions cannot be caught and will crash your program.
|
|
951
951
|
|
|
952
952
|
Parameters:
|
|
953
953
|
|
|
954
|
-
|param|type|description|
|
|
955
|
-
|
|
956
|
-
|
|
954
|
+
| param | type | description |
|
|
955
|
+
| ----- | ----------- | -------------------------- |
|
|
956
|
+
| `exn` | `Exception` | The exception to be thrown |
|
|
957
957
|
|
|
958
958
|
Returns:
|
|
959
959
|
|
|
960
|
-
|type|description|
|
|
961
|
-
|
|
962
|
-
|
|
960
|
+
| type | description |
|
|
961
|
+
| ---- | --------------------------------------------------------------- |
|
|
962
|
+
| `a` | Anything and nothing—your program won't continue past a throw |
|
|
963
963
|
|
|
964
964
|
### Pervasives.**fail**
|
|
965
965
|
|
|
966
966
|
```grain
|
|
967
|
-
fail
|
|
967
|
+
fail: (message: String) => a
|
|
968
968
|
```
|
|
969
969
|
|
|
970
970
|
Unconditionally throw a `Failure` exception with a message.
|
|
@@ -972,15 +972,15 @@ Currently, Exceptions cannot be caught and will crash your program.
|
|
|
972
972
|
|
|
973
973
|
Parameters:
|
|
974
974
|
|
|
975
|
-
|param|type|description|
|
|
976
|
-
|
|
977
|
-
|
|
975
|
+
| param | type | description |
|
|
976
|
+
| --------- | -------- | -------------------------- |
|
|
977
|
+
| `message` | `String` | The reason for the failure |
|
|
978
978
|
|
|
979
979
|
Returns:
|
|
980
980
|
|
|
981
|
-
|type|description|
|
|
982
|
-
|
|
983
|
-
|
|
981
|
+
| type | description |
|
|
982
|
+
| ---- | ------------------------------------------------------------------------- |
|
|
983
|
+
| `a` | Anything and nothing—your program won't continue past a fail expression |
|
|
984
984
|
|
|
985
985
|
### Pervasives.**identity**
|
|
986
986
|
|
|
@@ -990,22 +990,22 @@ No other changes yet.
|
|
|
990
990
|
</details>
|
|
991
991
|
|
|
992
992
|
```grain
|
|
993
|
-
identity
|
|
993
|
+
identity: (value: a) => a
|
|
994
994
|
```
|
|
995
995
|
|
|
996
996
|
Provides the operand untouched.
|
|
997
997
|
|
|
998
998
|
Parameters:
|
|
999
999
|
|
|
1000
|
-
|param|type|description|
|
|
1001
|
-
|
|
1002
|
-
|
|
1000
|
+
| param | type | description |
|
|
1001
|
+
| ------- | ---- | ------------------- |
|
|
1002
|
+
| `value` | `a` | The value to return |
|
|
1003
1003
|
|
|
1004
1004
|
Returns:
|
|
1005
1005
|
|
|
1006
|
-
|type|description|
|
|
1007
|
-
|
|
1008
|
-
|
|
1006
|
+
| type | description |
|
|
1007
|
+
| ---- | ------------------- |
|
|
1008
|
+
| `a` | The value untouched |
|
|
1009
1009
|
|
|
1010
1010
|
### Pervasives.**box**
|
|
1011
1011
|
|
|
@@ -1015,7 +1015,7 @@ No other changes yet.
|
|
|
1015
1015
|
</details>
|
|
1016
1016
|
|
|
1017
1017
|
```grain
|
|
1018
|
-
box
|
|
1018
|
+
box: (value: a) => Box<a>
|
|
1019
1019
|
```
|
|
1020
1020
|
|
|
1021
1021
|
Creates a box containing the given initial value.
|
|
@@ -1024,15 +1024,15 @@ Generally, `let mut` expressions are preferable to using a Box.
|
|
|
1024
1024
|
|
|
1025
1025
|
Parameters:
|
|
1026
1026
|
|
|
1027
|
-
|param|type|description|
|
|
1028
|
-
|
|
1029
|
-
|
|
1027
|
+
| param | type | description |
|
|
1028
|
+
| ------- | ---- | -------------------------------- |
|
|
1029
|
+
| `value` | `a` | The initial value inside the box |
|
|
1030
1030
|
|
|
1031
1031
|
Returns:
|
|
1032
1032
|
|
|
1033
|
-
|type|description|
|
|
1034
|
-
|
|
1035
|
-
|
|
1033
|
+
| type | description |
|
|
1034
|
+
| -------- | ------------------------------------ |
|
|
1035
|
+
| `Box<a>` | The box containing the initial value |
|
|
1036
1036
|
|
|
1037
1037
|
### Pervasives.**unbox**
|
|
1038
1038
|
|
|
@@ -1042,20 +1042,20 @@ No other changes yet.
|
|
|
1042
1042
|
</details>
|
|
1043
1043
|
|
|
1044
1044
|
```grain
|
|
1045
|
-
unbox
|
|
1045
|
+
unbox: (value: Box<a>) => a
|
|
1046
1046
|
```
|
|
1047
1047
|
|
|
1048
1048
|
Retrieves the current value from a box.
|
|
1049
1049
|
|
|
1050
1050
|
Parameters:
|
|
1051
1051
|
|
|
1052
|
-
|param|type|description|
|
|
1053
|
-
|
|
1054
|
-
|
|
1052
|
+
| param | type | description |
|
|
1053
|
+
| ------- | -------- | ----------------- |
|
|
1054
|
+
| `value` | `Box<a>` | The box to unwrap |
|
|
1055
1055
|
|
|
1056
1056
|
Returns:
|
|
1057
1057
|
|
|
1058
|
-
|type|description|
|
|
1059
|
-
|
|
1060
|
-
|
|
1058
|
+
| type | description |
|
|
1059
|
+
| ---- | ------------------------ |
|
|
1060
|
+
| `a` | The value inside the box |
|
|
1061
1061
|
|