@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/priorityqueue.md
CHANGED
|
@@ -60,16 +60,16 @@ queue and can use the default size.
|
|
|
60
60
|
|
|
61
61
|
Parameters:
|
|
62
62
|
|
|
63
|
-
|param|type|description|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
| param | type | description |
|
|
64
|
+
| ---------- | ------------------ | ------------------------------------------------------- |
|
|
65
|
+
| `?compare` | `(a, a) => Number` | The comparator function used to indicate priority order |
|
|
66
|
+
| `?size` | `Number` | The initial storage size of the priority queue |
|
|
67
67
|
|
|
68
68
|
Returns:
|
|
69
69
|
|
|
70
|
-
|type|description|
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
| type | description |
|
|
71
|
+
| ------------------ | ----------------------- |
|
|
72
|
+
| `PriorityQueue<a>` | An empty priority queue |
|
|
73
73
|
|
|
74
74
|
Examples:
|
|
75
75
|
|
|
@@ -100,15 +100,15 @@ Gets the number of elements in a priority queue.
|
|
|
100
100
|
|
|
101
101
|
Parameters:
|
|
102
102
|
|
|
103
|
-
|param|type|description|
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
| param | type | description |
|
|
104
|
+
| ----- | ------------------ | ----------------------------- |
|
|
105
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to inspect |
|
|
106
106
|
|
|
107
107
|
Returns:
|
|
108
108
|
|
|
109
|
-
|type|description|
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
| type | description |
|
|
110
|
+
| -------- | -------------------------------------------- |
|
|
111
|
+
| `Number` | The number of elements in the priority queue |
|
|
112
112
|
|
|
113
113
|
### PriorityQueue.**isEmpty**
|
|
114
114
|
|
|
@@ -125,15 +125,15 @@ Determines if the priority queue contains no elements.
|
|
|
125
125
|
|
|
126
126
|
Parameters:
|
|
127
127
|
|
|
128
|
-
|param|type|description|
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
| param | type | description |
|
|
129
|
+
| ----- | ------------------ | --------------------------- |
|
|
130
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to check |
|
|
131
131
|
|
|
132
132
|
Returns:
|
|
133
133
|
|
|
134
|
-
|type|description|
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
| type | description |
|
|
135
|
+
| ------ | ----------------------------------------------------------- |
|
|
136
|
+
| `Bool` | `true` if the priority queue is empty and `false` otherwise |
|
|
137
137
|
|
|
138
138
|
### PriorityQueue.**push**
|
|
139
139
|
|
|
@@ -150,10 +150,10 @@ Adds a new element to the priority queue.
|
|
|
150
150
|
|
|
151
151
|
Parameters:
|
|
152
152
|
|
|
153
|
-
|param|type|description|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
| param | type | description |
|
|
154
|
+
| ----- | ------------------ | ---------------------------------------- |
|
|
155
|
+
| `val` | `a` | The value to add into the priority queue |
|
|
156
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to update |
|
|
157
157
|
|
|
158
158
|
### PriorityQueue.**peek**
|
|
159
159
|
|
|
@@ -171,15 +171,15 @@ removed from the queue.
|
|
|
171
171
|
|
|
172
172
|
Parameters:
|
|
173
173
|
|
|
174
|
-
|param|type|description|
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
| param | type | description |
|
|
175
|
+
| ----- | ------------------ | ----------------------------- |
|
|
176
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to inspect |
|
|
177
177
|
|
|
178
178
|
Returns:
|
|
179
179
|
|
|
180
|
-
|type|description|
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
| type | description |
|
|
181
|
+
| ----------- | ---------------------------------------------------------------------------------------------- |
|
|
182
|
+
| `Option<a>` | `Some(value)` containing the highest priority element or `None` if the priority queue is empty |
|
|
183
183
|
|
|
184
184
|
### PriorityQueue.**pop**
|
|
185
185
|
|
|
@@ -196,15 +196,15 @@ Removes and retrieves the highest priority element in the priority queue.
|
|
|
196
196
|
|
|
197
197
|
Parameters:
|
|
198
198
|
|
|
199
|
-
|param|type|description|
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
| param | type | description |
|
|
200
|
+
| ----- | ------------------ | ----------------------------- |
|
|
201
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to inspect |
|
|
202
202
|
|
|
203
203
|
Returns:
|
|
204
204
|
|
|
205
|
-
|type|description|
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
| type | description |
|
|
206
|
+
| ----------- | ---------------------------------------------------------------------------------------------- |
|
|
207
|
+
| `Option<a>` | `Some(value)` containing the highest priority element or `None` if the priority queue is empty |
|
|
208
208
|
|
|
209
209
|
### PriorityQueue.**drain**
|
|
210
210
|
|
|
@@ -222,15 +222,15 @@ queue in priority order.
|
|
|
222
222
|
|
|
223
223
|
Parameters:
|
|
224
224
|
|
|
225
|
-
|param|type|description|
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
| param | type | description |
|
|
226
|
+
| ----- | ------------------ | --------------------------- |
|
|
227
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to drain |
|
|
228
228
|
|
|
229
229
|
Returns:
|
|
230
230
|
|
|
231
|
-
|type|description|
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
| type | description |
|
|
232
|
+
| --------- | -------------------------------------------------------- |
|
|
233
|
+
| `List<a>` | A list of all elements in the priority in priority order |
|
|
234
234
|
|
|
235
235
|
### PriorityQueue.**fromArray**
|
|
236
236
|
|
|
@@ -259,16 +259,16 @@ and a negative number if the first has less priority.
|
|
|
259
259
|
|
|
260
260
|
Parameters:
|
|
261
261
|
|
|
262
|
-
|param|type|description|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
| param | type | description |
|
|
263
|
+
| ---------- | ------------------ | --------------------------------------------------------- |
|
|
264
|
+
| `array` | `Array<a>` | An array of values used to initialize the priority queue |
|
|
265
|
+
| `?compare` | `(a, a) => Number` | A comparator function used to assign priority to elements |
|
|
266
266
|
|
|
267
267
|
Returns:
|
|
268
268
|
|
|
269
|
-
|type|description|
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
| type | description |
|
|
270
|
+
| ------------------ | ------------------------------------------------------- |
|
|
271
|
+
| `PriorityQueue<a>` | A priority queue containing the elements from the array |
|
|
272
272
|
|
|
273
273
|
### PriorityQueue.**fromList**
|
|
274
274
|
|
|
@@ -296,16 +296,16 @@ and a negative number if the first has less priority.
|
|
|
296
296
|
|
|
297
297
|
Parameters:
|
|
298
298
|
|
|
299
|
-
|param|type|description|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
| param | type | description |
|
|
300
|
+
| ---------- | ------------------ | --------------------------------------------------------- |
|
|
301
|
+
| `list` | `List<a>` | A list of values used to initialize the priority queue |
|
|
302
|
+
| `?compare` | `(a, a) => Number` | A comparator function used to assign priority to elements |
|
|
303
303
|
|
|
304
304
|
Returns:
|
|
305
305
|
|
|
306
|
-
|type|description|
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
| type | description |
|
|
307
|
+
| ------------------ | ------------------------------------------------------ |
|
|
308
|
+
| `PriorityQueue<a>` | A priority queue containing the elements from the list |
|
|
309
309
|
|
|
310
310
|
## PriorityQueue.Immutable
|
|
311
311
|
|
|
@@ -384,15 +384,15 @@ has greater priority, and a negative number if the first has less priority.
|
|
|
384
384
|
|
|
385
385
|
Parameters:
|
|
386
386
|
|
|
387
|
-
|param|type|description|
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
| param | type | description |
|
|
388
|
+
| ---------- | ------------------ | ------------------------------------------------------- |
|
|
389
|
+
| `?compare` | `(a, a) => Number` | The comparator function used to indicate priority order |
|
|
390
390
|
|
|
391
391
|
Returns:
|
|
392
392
|
|
|
393
|
-
|type|description|
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
| type | description |
|
|
394
|
+
| ------------------ | ----------------------- |
|
|
395
|
+
| `PriorityQueue<a>` | An empty priority queue |
|
|
396
396
|
|
|
397
397
|
Examples:
|
|
398
398
|
|
|
@@ -426,15 +426,15 @@ Gets the number of elements in a priority queue.
|
|
|
426
426
|
|
|
427
427
|
Parameters:
|
|
428
428
|
|
|
429
|
-
|param|type|description|
|
|
430
|
-
|
|
431
|
-
|
|
429
|
+
| param | type | description |
|
|
430
|
+
| ----- | ------------------ | ----------------------------- |
|
|
431
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to inspect |
|
|
432
432
|
|
|
433
433
|
Returns:
|
|
434
434
|
|
|
435
|
-
|type|description|
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
| type | description |
|
|
436
|
+
| -------- | -------------------------------------------- |
|
|
437
|
+
| `Number` | The number of elements in the priority queue |
|
|
438
438
|
|
|
439
439
|
#### PriorityQueue.Immutable.**isEmpty**
|
|
440
440
|
|
|
@@ -458,15 +458,15 @@ Determines if the priority queue contains no elements.
|
|
|
458
458
|
|
|
459
459
|
Parameters:
|
|
460
460
|
|
|
461
|
-
|param|type|description|
|
|
462
|
-
|
|
463
|
-
|
|
461
|
+
| param | type | description |
|
|
462
|
+
| ----- | ------------------ | --------------------------- |
|
|
463
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to check |
|
|
464
464
|
|
|
465
465
|
Returns:
|
|
466
466
|
|
|
467
|
-
|type|description|
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
| type | description |
|
|
468
|
+
| ------ | ----------------------------------------------------------- |
|
|
469
|
+
| `Bool` | `true` if the priority queue is empty and `false` otherwise |
|
|
470
470
|
|
|
471
471
|
#### PriorityQueue.Immutable.**push**
|
|
472
472
|
|
|
@@ -490,16 +490,16 @@ Produces a new priority queue by inserting the given element into the given prio
|
|
|
490
490
|
|
|
491
491
|
Parameters:
|
|
492
492
|
|
|
493
|
-
|param|type|description|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
493
|
+
| param | type | description |
|
|
494
|
+
| ----- | ------------------ | ---------------------------------------- |
|
|
495
|
+
| `val` | `a` | The value to add into the priority queue |
|
|
496
|
+
| `pq` | `PriorityQueue<a>` | The priority queue |
|
|
497
497
|
|
|
498
498
|
Returns:
|
|
499
499
|
|
|
500
|
-
|type|description|
|
|
501
|
-
|
|
502
|
-
|
|
500
|
+
| type | description |
|
|
501
|
+
| ------------------ | ---------------------------------------------------- |
|
|
502
|
+
| `PriorityQueue<a>` | A new priority queue with the given element inserted |
|
|
503
503
|
|
|
504
504
|
#### PriorityQueue.Immutable.**peek**
|
|
505
505
|
|
|
@@ -524,15 +524,15 @@ removed from the queue.
|
|
|
524
524
|
|
|
525
525
|
Parameters:
|
|
526
526
|
|
|
527
|
-
|param|type|description|
|
|
528
|
-
|
|
529
|
-
|
|
527
|
+
| param | type | description |
|
|
528
|
+
| ----- | ------------------ | ----------------------------- |
|
|
529
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to inspect |
|
|
530
530
|
|
|
531
531
|
Returns:
|
|
532
532
|
|
|
533
|
-
|type|description|
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
| type | description |
|
|
534
|
+
| ----------- | ---------------------------------------------------------------------------------------------- |
|
|
535
|
+
| `Option<a>` | `Some(value)` containing the highest priority element or `None` if the priority queue is empty |
|
|
536
536
|
|
|
537
537
|
#### PriorityQueue.Immutable.**pop**
|
|
538
538
|
|
|
@@ -558,15 +558,15 @@ return it.
|
|
|
558
558
|
|
|
559
559
|
Parameters:
|
|
560
560
|
|
|
561
|
-
|param|type|description|
|
|
562
|
-
|
|
563
|
-
|
|
561
|
+
| param | type | description |
|
|
562
|
+
| ----- | ------------------ | ------------------ |
|
|
563
|
+
| `pq` | `PriorityQueue<a>` | The priority queue |
|
|
564
564
|
|
|
565
565
|
Returns:
|
|
566
566
|
|
|
567
|
-
|type|description|
|
|
568
|
-
|
|
569
|
-
|
|
567
|
+
| type | description |
|
|
568
|
+
| ------------------ | --------------------------------------------------------- |
|
|
569
|
+
| `PriorityQueue<a>` | A new priority queue without the highest priority element |
|
|
570
570
|
|
|
571
571
|
#### PriorityQueue.Immutable.**drain**
|
|
572
572
|
|
|
@@ -590,15 +590,15 @@ Produces a list of all elements in the priority queue in priority order.
|
|
|
590
590
|
|
|
591
591
|
Parameters:
|
|
592
592
|
|
|
593
|
-
|param|type|description|
|
|
594
|
-
|
|
595
|
-
|
|
593
|
+
| param | type | description |
|
|
594
|
+
| ----- | ------------------ | --------------------------- |
|
|
595
|
+
| `pq` | `PriorityQueue<a>` | The priority queue to drain |
|
|
596
596
|
|
|
597
597
|
Returns:
|
|
598
598
|
|
|
599
|
-
|type|description|
|
|
600
|
-
|
|
601
|
-
|
|
599
|
+
| type | description |
|
|
600
|
+
| --------- | -------------------------------------------------------- |
|
|
601
|
+
| `List<a>` | A list of all elements in the priority in priority order |
|
|
602
602
|
|
|
603
603
|
#### PriorityQueue.Immutable.**fromList**
|
|
604
604
|
|
|
@@ -626,16 +626,16 @@ and a negative number if the first has less priority.
|
|
|
626
626
|
|
|
627
627
|
Parameters:
|
|
628
628
|
|
|
629
|
-
|param|type|description|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
629
|
+
| param | type | description |
|
|
630
|
+
| ---------- | ------------------ | --------------------------------------------------------- |
|
|
631
|
+
| `list` | `List<a>` | A list of values used to initialize the priority queue |
|
|
632
|
+
| `?compare` | `(a, a) => Number` | A comparator function used to assign priority to elements |
|
|
633
633
|
|
|
634
634
|
Returns:
|
|
635
635
|
|
|
636
|
-
|type|description|
|
|
637
|
-
|
|
638
|
-
|
|
636
|
+
| type | description |
|
|
637
|
+
| ------------------ | ------------------------------------------------------ |
|
|
638
|
+
| `PriorityQueue<a>` | A priority queue containing the elements from the list |
|
|
639
639
|
|
|
640
640
|
#### PriorityQueue.Immutable.**fromArray**
|
|
641
641
|
|
|
@@ -664,14 +664,14 @@ and a negative number if the first has less priority.
|
|
|
664
664
|
|
|
665
665
|
Parameters:
|
|
666
666
|
|
|
667
|
-
|param|type|description|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
667
|
+
| param | type | description |
|
|
668
|
+
| ---------- | ------------------ | --------------------------------------------------------- |
|
|
669
|
+
| `array` | `Array<a>` | An array of values used to initialize the priority queue |
|
|
670
|
+
| `?compare` | `(a, a) => Number` | A comparator function used to assign priority to elements |
|
|
671
671
|
|
|
672
672
|
Returns:
|
|
673
673
|
|
|
674
|
-
|type|description|
|
|
675
|
-
|
|
676
|
-
|
|
674
|
+
| type | description |
|
|
675
|
+
| ------------------ | ------------------------------------------------------- |
|
|
676
|
+
| `PriorityQueue<a>` | A priority queue containing the elements from the array |
|
|
677
677
|
|