@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.
Files changed (137) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/LICENSE +1 -1
  3. package/README.md +2 -2
  4. package/array.gr +55 -7
  5. package/array.md +606 -560
  6. package/bigint.md +228 -228
  7. package/buffer.gr +85 -53
  8. package/buffer.md +442 -319
  9. package/bytes.gr +112 -35
  10. package/bytes.md +299 -219
  11. package/char.gr +201 -99
  12. package/char.md +447 -120
  13. package/exception.gr +11 -11
  14. package/exception.md +29 -4
  15. package/float32.gr +327 -3
  16. package/float32.md +698 -111
  17. package/float64.gr +320 -3
  18. package/float64.md +698 -111
  19. package/fs.gr +1082 -0
  20. package/fs.md +630 -0
  21. package/hash.gr +142 -88
  22. package/hash.md +105 -17
  23. package/int16.md +178 -178
  24. package/int32.gr +26 -5
  25. package/int32.md +266 -231
  26. package/int64.gr +27 -2
  27. package/int64.md +266 -231
  28. package/int8.md +178 -178
  29. package/json.gr +366 -51
  30. package/json.md +431 -15
  31. package/list.gr +328 -31
  32. package/list.md +759 -336
  33. package/map.gr +20 -12
  34. package/map.md +266 -260
  35. package/marshal.gr +41 -40
  36. package/marshal.md +14 -14
  37. package/number.gr +278 -35
  38. package/number.md +688 -269
  39. package/option.md +162 -162
  40. package/package.json +5 -3
  41. package/path.gr +48 -0
  42. package/path.md +180 -89
  43. package/pervasives.gr +2 -2
  44. package/pervasives.md +275 -275
  45. package/priorityqueue.gr +7 -7
  46. package/priorityqueue.md +131 -131
  47. package/queue.gr +183 -29
  48. package/queue.md +404 -148
  49. package/random.md +43 -43
  50. package/range.gr +4 -4
  51. package/range.md +42 -42
  52. package/rational.md +123 -123
  53. package/regex.gr +52 -51
  54. package/regex.md +102 -102
  55. package/result.md +118 -118
  56. package/runtime/atof/common.md +39 -39
  57. package/runtime/atof/decimal.gr +6 -6
  58. package/runtime/atof/decimal.md +14 -14
  59. package/runtime/atof/lemire.gr +5 -5
  60. package/runtime/atof/lemire.md +1 -1
  61. package/runtime/atof/parse.gr +16 -16
  62. package/runtime/atof/parse.md +2 -2
  63. package/runtime/atof/slow.md +1 -1
  64. package/runtime/atof/table.md +2 -2
  65. package/runtime/atoi/parse.gr +3 -3
  66. package/runtime/atoi/parse.md +1 -1
  67. package/runtime/bigint.gr +15 -47
  68. package/runtime/bigint.md +54 -60
  69. package/runtime/compare.gr +2 -2
  70. package/runtime/compare.md +8 -8
  71. package/runtime/dataStructures.md +211 -211
  72. package/runtime/debugPrint.gr +4 -1
  73. package/runtime/debugPrint.md +9 -9
  74. package/runtime/equal.gr +99 -77
  75. package/runtime/equal.md +8 -8
  76. package/runtime/exception.gr +62 -82
  77. package/runtime/exception.md +62 -11
  78. package/runtime/gc.gr +39 -45
  79. package/runtime/gc.md +4 -4
  80. package/runtime/malloc.gr +7 -7
  81. package/runtime/malloc.md +13 -13
  82. package/runtime/math/kernel/cos.gr +70 -0
  83. package/runtime/math/kernel/cos.md +14 -0
  84. package/runtime/math/kernel/sin.gr +65 -0
  85. package/runtime/math/kernel/sin.md +14 -0
  86. package/runtime/math/kernel/tan.gr +136 -0
  87. package/runtime/math/kernel/tan.md +14 -0
  88. package/runtime/math/rempio2.gr +244 -0
  89. package/runtime/math/rempio2.md +14 -0
  90. package/runtime/math/trig.gr +130 -0
  91. package/runtime/math/trig.md +28 -0
  92. package/runtime/math/umuldi.gr +26 -0
  93. package/runtime/math/umuldi.md +14 -0
  94. package/runtime/numberUtils.gr +29 -29
  95. package/runtime/numberUtils.md +12 -12
  96. package/runtime/numbers.gr +373 -381
  97. package/runtime/numbers.md +348 -342
  98. package/runtime/string.gr +37 -105
  99. package/runtime/string.md +20 -26
  100. package/runtime/unsafe/constants.md +24 -24
  101. package/runtime/unsafe/conv.md +19 -19
  102. package/runtime/unsafe/memory.gr +24 -20
  103. package/runtime/unsafe/memory.md +27 -7
  104. package/runtime/unsafe/offsets.gr +36 -0
  105. package/runtime/unsafe/offsets.md +88 -0
  106. package/runtime/unsafe/panic.gr +28 -0
  107. package/runtime/unsafe/panic.md +14 -0
  108. package/runtime/unsafe/tags.md +32 -32
  109. package/runtime/unsafe/wasmf32.md +28 -28
  110. package/runtime/unsafe/wasmf64.md +28 -28
  111. package/runtime/unsafe/wasmi32.md +47 -47
  112. package/runtime/unsafe/wasmi64.md +50 -50
  113. package/runtime/utf8.gr +189 -0
  114. package/runtime/utf8.md +117 -0
  115. package/runtime/wasi.gr +4 -2
  116. package/runtime/wasi.md +147 -147
  117. package/set.gr +18 -11
  118. package/set.md +253 -247
  119. package/stack.gr +171 -2
  120. package/stack.md +371 -89
  121. package/string.gr +352 -557
  122. package/string.md +298 -255
  123. package/uint16.md +170 -170
  124. package/uint32.gr +25 -4
  125. package/uint32.md +249 -214
  126. package/uint64.gr +25 -5
  127. package/uint64.md +249 -214
  128. package/uint8.md +170 -170
  129. package/uri.gr +57 -53
  130. package/uri.md +88 -89
  131. package/wasi/file.gr +67 -59
  132. package/wasi/file.md +308 -308
  133. package/wasi/process.md +26 -26
  134. package/wasi/random.md +12 -12
  135. package/wasi/time.md +16 -16
  136. package/runtime/utils/printing.gr +0 -60
  137. package/runtime/utils/printing.md +0 -26
package/list.md CHANGED
@@ -25,6 +25,31 @@ from "list" include List
25
25
 
26
26
  Functions and constants included in the List module.
27
27
 
28
+ ### List.**reverse**
29
+
30
+ <details disabled>
31
+ <summary tabindex="-1">Added in <code>0.1.0</code></summary>
32
+ No other changes yet.
33
+ </details>
34
+
35
+ ```grain
36
+ reverse: (list: List<a>) => List<a>
37
+ ```
38
+
39
+ Creates a new list with all elements in reverse order.
40
+
41
+ Parameters:
42
+
43
+ | param | type | description |
44
+ | ------ | --------- | ------------------- |
45
+ | `list` | `List<a>` | The list to reverse |
46
+
47
+ Returns:
48
+
49
+ | type | description |
50
+ | --------- | ------------ |
51
+ | `List<a>` | The new list |
52
+
28
53
  ### List.**init**
29
54
 
30
55
  <details disabled>
@@ -33,7 +58,7 @@ No other changes yet.
33
58
  </details>
34
59
 
35
60
  ```grain
36
- init : (length: Number, fn: (Number => a)) => List<a>
61
+ init: (length: Number, fn: (Number => a)) => List<a>
37
62
  ```
38
63
 
39
64
  Creates a new list of the specified length where each element is
@@ -42,16 +67,16 @@ is called with the index of each list element.
42
67
 
43
68
  Parameters:
44
69
 
45
- |param|type|description|
46
- |-----|----|-----------|
47
- |`length`|`Number`|The length of the new list|
48
- |`fn`|`Number => a`|The initializer function to call with each index, where the value returned will be used to initialize the element|
70
+ | param | type | description |
71
+ | -------- | ------------- | ----------------------------------------------------------------------------------------------------------------- |
72
+ | `length` | `Number` | The length of the new list |
73
+ | `fn` | `Number => a` | The initializer function to call with each index, where the value returned will be used to initialize the element |
49
74
 
50
75
  Returns:
51
76
 
52
- |type|description|
53
- |----|-----------|
54
- |`List<a>`|The new list|
77
+ | type | description |
78
+ | --------- | ------------ |
79
+ | `List<a>` | The new list |
55
80
 
56
81
  Examples:
57
82
 
@@ -74,22 +99,22 @@ List.init(5, n => n + 3) // [3, 4, 5, 6, 7]
74
99
  </details>
75
100
 
76
101
  ```grain
77
- length : (list: List<a>) => Number
102
+ length: (list: List<a>) => Number
78
103
  ```
79
104
 
80
105
  Computes the length of the input list.
81
106
 
82
107
  Parameters:
83
108
 
84
- |param|type|description|
85
- |-----|----|-----------|
86
- |`list`|`List<a>`|The list to inspect|
109
+ | param | type | description |
110
+ | ------ | --------- | ------------------- |
111
+ | `list` | `List<a>` | The list to inspect |
87
112
 
88
113
  Returns:
89
114
 
90
- |type|description|
91
- |----|-----------|
92
- |`Number`|The number of elements in the list|
115
+ | type | description |
116
+ | -------- | ---------------------------------- |
117
+ | `Number` | The number of elements in the list |
93
118
 
94
119
  ### List.**isEmpty**
95
120
 
@@ -99,47 +124,22 @@ No other changes yet.
99
124
  </details>
100
125
 
101
126
  ```grain
102
- isEmpty : (list: List<a>) => Bool
127
+ isEmpty: (list: List<a>) => Bool
103
128
  ```
104
129
 
105
130
  Determines if the list contains no elements.
106
131
 
107
132
  Parameters:
108
133
 
109
- |param|type|description|
110
- |-----|----|-----------|
111
- |`list`|`List<a>`|The list to inspect|
134
+ | param | type | description |
135
+ | ------ | --------- | ------------------- |
136
+ | `list` | `List<a>` | The list to inspect |
112
137
 
113
138
  Returns:
114
139
 
115
- |type|description|
116
- |----|-----------|
117
- |`Bool`|`true` if the list is empty and `false` otherwise|
118
-
119
- ### List.**reverse**
120
-
121
- <details disabled>
122
- <summary tabindex="-1">Added in <code>0.1.0</code></summary>
123
- No other changes yet.
124
- </details>
125
-
126
- ```grain
127
- reverse : (list: List<a>) => List<a>
128
- ```
129
-
130
- Creates a new list with all elements in reverse order.
131
-
132
- Parameters:
133
-
134
- |param|type|description|
135
- |-----|----|-----------|
136
- |`list`|`List<a>`|The list to reverse|
137
-
138
- Returns:
139
-
140
- |type|description|
141
- |----|-----------|
142
- |`List<a>`|The new list|
140
+ | type | description |
141
+ | ------ | ------------------------------------------------- |
142
+ | `Bool` | `true` if the list is empty and `false` otherwise |
143
143
 
144
144
  ### List.**append**
145
145
 
@@ -149,7 +149,7 @@ No other changes yet.
149
149
  </details>
150
150
 
151
151
  ```grain
152
- append : (list1: List<a>, list2: List<a>) => List<a>
152
+ append: (list1: List<a>, list2: List<a>) => List<a>
153
153
  ```
154
154
 
155
155
  Creates a new list with the elements of the first list followed by
@@ -157,16 +157,16 @@ the elements of the second list.
157
157
 
158
158
  Parameters:
159
159
 
160
- |param|type|description|
161
- |-----|----|-----------|
162
- |`list1`|`List<a>`|The list containing elements to appear first|
163
- |`list2`|`List<a>`|The list containing elements to appear second|
160
+ | param | type | description |
161
+ | ------- | --------- | --------------------------------------------- |
162
+ | `list1` | `List<a>` | The list containing elements to appear first |
163
+ | `list2` | `List<a>` | The list containing elements to appear second |
164
164
 
165
165
  Returns:
166
166
 
167
- |type|description|
168
- |----|-----------|
169
- |`List<a>`|The new list containing elements from `list1` followed by elements from `list2`|
167
+ | type | description |
168
+ | --------- | ------------------------------------------------------------------------------- |
169
+ | `List<a>` | The new list containing elements from `list1` followed by elements from `list2` |
170
170
 
171
171
  ### List.**contains**
172
172
 
@@ -176,7 +176,7 @@ No other changes yet.
176
176
  </details>
177
177
 
178
178
  ```grain
179
- contains : (search: a, list: List<a>) => Bool
179
+ contains: (search: a, list: List<a>) => Bool
180
180
  ```
181
181
 
182
182
  Checks if the value is an element of the input list.
@@ -184,16 +184,16 @@ Uses the generic `==` structural equality operator.
184
184
 
185
185
  Parameters:
186
186
 
187
- |param|type|description|
188
- |-----|----|-----------|
189
- |`search`|`a`|The value to compare|
190
- |`list`|`List<a>`|The list to inspect|
187
+ | param | type | description |
188
+ | -------- | --------- | -------------------- |
189
+ | `search` | `a` | The value to compare |
190
+ | `list` | `List<a>` | The list to inspect |
191
191
 
192
192
  Returns:
193
193
 
194
- |type|description|
195
- |----|-----------|
196
- |`Bool`|`true` if the value exists in the list or `false` otherwise|
194
+ | type | description |
195
+ | ------ | ----------------------------------------------------------- |
196
+ | `Bool` | `true` if the value exists in the list or `false` otherwise |
197
197
 
198
198
  ### List.**reduce**
199
199
 
@@ -211,7 +211,7 @@ Returns:
211
211
  </details>
212
212
 
213
213
  ```grain
214
- reduce : (fn: ((a, b) => a), initial: a, list: List<b>) => a
214
+ reduce: (fn: ((a, b) => a), initial: a, list: List<b>) => a
215
215
  ```
216
216
 
217
217
  Combines all elements of a list using a reducer function,
@@ -224,17 +224,17 @@ returned. The accumulator starts with value `initial`.
224
224
 
225
225
  Parameters:
226
226
 
227
- |param|type|description|
228
- |-----|----|-----------|
229
- |`fn`|`(a, b) => a`|The reducer function to call on each element, where the value returned will be the next accumulator value|
230
- |`initial`|`a`|The initial value to use for the accumulator on the first iteration|
231
- |`list`|`List<b>`|The list to iterate|
227
+ | param | type | description |
228
+ | --------- | ------------- | --------------------------------------------------------------------------------------------------------- |
229
+ | `fn` | `(a, b) => a` | The reducer function to call on each element, where the value returned will be the next accumulator value |
230
+ | `initial` | `a` | The initial value to use for the accumulator on the first iteration |
231
+ | `list` | `List<b>` | The list to iterate |
232
232
 
233
233
  Returns:
234
234
 
235
- |type|description|
236
- |----|-----------|
237
- |`a`|The final accumulator returned from `fn`|
235
+ | type | description |
236
+ | ---- | ---------------------------------------- |
237
+ | `a` | The final accumulator returned from `fn` |
238
238
 
239
239
  Examples:
240
240
 
@@ -258,7 +258,7 @@ List.reduce((a, b) => a + b, 0, [1, 2, 3]) // 6
258
258
  </details>
259
259
 
260
260
  ```grain
261
- reduceRight : (fn: ((a, b) => b), initial: b, list: List<a>) => b
261
+ reduceRight: (fn: ((a, b) => b), initial: b, list: List<a>) => b
262
262
  ```
263
263
 
264
264
  Combines all elements of a list using a reducer function,
@@ -271,17 +271,17 @@ returned. The accumulator starts with value `initial`.
271
271
 
272
272
  Parameters:
273
273
 
274
- |param|type|description|
275
- |-----|----|-----------|
276
- |`fn`|`(a, b) => b`|The reducer function to call on each element, where the value returned will be the next accumulator value|
277
- |`initial`|`b`|The initial value to use for the accumulator on the first iteration|
278
- |`list`|`List<a>`|The list to iterate|
274
+ | param | type | description |
275
+ | --------- | ------------- | --------------------------------------------------------------------------------------------------------- |
276
+ | `fn` | `(a, b) => b` | The reducer function to call on each element, where the value returned will be the next accumulator value |
277
+ | `initial` | `b` | The initial value to use for the accumulator on the first iteration |
278
+ | `list` | `List<a>` | The list to iterate |
279
279
 
280
280
  Returns:
281
281
 
282
- |type|description|
283
- |----|-----------|
284
- |`b`|The final accumulator returned from `fn`|
282
+ | type | description |
283
+ | ---- | ---------------------------------------- |
284
+ | `b` | The final accumulator returned from `fn` |
285
285
 
286
286
  Examples:
287
287
 
@@ -297,7 +297,7 @@ No other changes yet.
297
297
  </details>
298
298
 
299
299
  ```grain
300
- map : (fn: (a => b), list: List<a>) => List<b>
300
+ map: (fn: (a => b), list: List<a>) => List<b>
301
301
  ```
302
302
 
303
303
  Produces a new list initialized with the results of a mapper function
@@ -305,16 +305,16 @@ called on each element of the input list.
305
305
 
306
306
  Parameters:
307
307
 
308
- |param|type|description|
309
- |-----|----|-----------|
310
- |`fn`|`a => b`|The mapper function to call on each element, where the value returned will be used to initialize the element in the new list|
311
- |`list`|`List<a>`|The list to iterate|
308
+ | param | type | description |
309
+ | ------ | --------- | ---------------------------------------------------------------------------------------------------------------------------- |
310
+ | `fn` | `a => b` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
311
+ | `list` | `List<a>` | The list to iterate |
312
312
 
313
313
  Returns:
314
314
 
315
- |type|description|
316
- |----|-----------|
317
- |`List<b>`|The new list with mapped values|
315
+ | type | description |
316
+ | --------- | ------------------------------- |
317
+ | `List<b>` | The new list with mapped values |
318
318
 
319
319
  ### List.**mapi**
320
320
 
@@ -324,24 +324,96 @@ No other changes yet.
324
324
  </details>
325
325
 
326
326
  ```grain
327
- mapi : (fn: ((a, Number) => b), list: List<a>) => List<b>
327
+ mapi: (fn: ((a, Number) => b), list: List<a>) => List<b>
328
+ ```
329
+
330
+ Produces a new list initialized with the results of a mapper function
331
+ called on each element of the input list and its index.
332
+
333
+ Parameters:
334
+
335
+ | param | type | description |
336
+ | ------ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
337
+ | `fn` | `(a, Number) => b` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
338
+ | `list` | `List<a>` | The list to iterate |
339
+
340
+ Returns:
341
+
342
+ | type | description |
343
+ | --------- | ------------------------------- |
344
+ | `List<b>` | The new list with mapped values |
345
+
346
+ ### List.**filterMap**
347
+
348
+ <details disabled>
349
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
350
+ No other changes yet.
351
+ </details>
352
+
353
+ ```grain
354
+ filterMap: (fn: (a => Option<b>), list: List<a>) => List<b>
355
+ ```
356
+
357
+ Produces a new list initialized with the results of a mapper function
358
+ called on each element of the input list.
359
+ The mapper function can return `None` to exclude the element from the new list.
360
+
361
+ Parameters:
362
+
363
+ | param | type | description |
364
+ | ------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- |
365
+ | `fn` | `a => Option<b>` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
366
+ | `list` | `List<a>` | The list to iterate |
367
+
368
+ Returns:
369
+
370
+ | type | description |
371
+ | --------- | ---------------------------------------- |
372
+ | `List<b>` | The new list with filtered mapped values |
373
+
374
+ Examples:
375
+
376
+ ```grain
377
+ List.filterMap(x => if (x % 2 == 0) Some(toString(x)) else None, [1, 2, 3, 4]) == ["2", "4"]
378
+ ```
379
+
380
+ ### List.**filterMapi**
381
+
382
+ <details disabled>
383
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
384
+ No other changes yet.
385
+ </details>
386
+
387
+ ```grain
388
+ filterMapi: (fn: ((a, Number) => Option<b>), list: List<a>) => List<b>
328
389
  ```
329
390
 
330
391
  Produces a new list initialized with the results of a mapper function
331
392
  called on each element of the input list and its index.
393
+ The mapper function can return `None` to exclude the element from the new list.
332
394
 
333
395
  Parameters:
334
396
 
335
- |param|type|description|
336
- |-----|----|-----------|
337
- |`fn`|`(a, Number) => b`|The mapper function to call on each element, where the value returned will be used to initialize the element in the new list|
338
- |`list`|`List<a>`|The list to iterate|
397
+ | param | type | description |
398
+ | ------ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
399
+ | `fn` | `(a, Number) => Option<b>` | The mapper function to call on each element, where the value returned will be used to initialize the element in the new list |
400
+ | `list` | `List<a>` | The list to iterate |
339
401
 
340
402
  Returns:
341
403
 
342
- |type|description|
343
- |----|-----------|
344
- |`List<b>`|The new list with mapped values|
404
+ | type | description |
405
+ | --------- | ---------------------------------------- |
406
+ | `List<b>` | The new list with filtered mapped values |
407
+
408
+ Examples:
409
+
410
+ ```grain
411
+ List.filterMapi((x, i) => if (x % 2 == 0) Some(toString(x)) else None, [1, 2, 3, 4]) == ["2", "4"]
412
+ ```
413
+
414
+ ```grain
415
+ List.filterMapi((x, i) => if (i == 0) Some(toString(x)) else None, [1, 2, 3, 4]) == ["1"]
416
+ ```
345
417
 
346
418
  ### List.**flatMap**
347
419
 
@@ -351,7 +423,7 @@ No other changes yet.
351
423
  </details>
352
424
 
353
425
  ```grain
354
- flatMap : (fn: (a => List<b>), list: List<a>) => List<b>
426
+ flatMap: (fn: (a => List<b>), list: List<a>) => List<b>
355
427
  ```
356
428
 
357
429
  Produces a new list by calling a function on each element
@@ -361,16 +433,16 @@ of all results.
361
433
 
362
434
  Parameters:
363
435
 
364
- |param|type|description|
365
- |-----|----|-----------|
366
- |`fn`|`a => List<b>`|The function to be called on each element, where the value returned will be a list that gets appended to the new list|
367
- |`list`|`List<a>`|The list to iterate|
436
+ | param | type | description |
437
+ | ------ | -------------- | --------------------------------------------------------------------------------------------------------------------- |
438
+ | `fn` | `a => List<b>` | The function to be called on each element, where the value returned will be a list that gets appended to the new list |
439
+ | `list` | `List<a>` | The list to iterate |
368
440
 
369
441
  Returns:
370
442
 
371
- |type|description|
372
- |----|-----------|
373
- |`List<b>`|The new list|
443
+ | type | description |
444
+ | --------- | ------------ |
445
+ | `List<b>` | The new list |
374
446
 
375
447
  ### List.**every**
376
448
 
@@ -380,7 +452,7 @@ No other changes yet.
380
452
  </details>
381
453
 
382
454
  ```grain
383
- every : (fn: (a => Bool), list: List<a>) => Bool
455
+ every: (fn: (a => Bool), list: List<a>) => Bool
384
456
  ```
385
457
 
386
458
  Checks that the given condition is satisfied for all
@@ -388,16 +460,16 @@ elements in the input list.
388
460
 
389
461
  Parameters:
390
462
 
391
- |param|type|description|
392
- |-----|----|-----------|
393
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
394
- |`list`|`List<a>`|The list to check|
463
+ | param | type | description |
464
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
465
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
466
+ | `list` | `List<a>` | The list to check |
395
467
 
396
468
  Returns:
397
469
 
398
- |type|description|
399
- |----|-----------|
400
- |`Bool`|`true` if all elements satify the condition or `false` otherwise|
470
+ | type | description |
471
+ | ------ | ----------------------------------------------------------------- |
472
+ | `Bool` | `true` if all elements satisfy the condition or `false` otherwise |
401
473
 
402
474
  ### List.**some**
403
475
 
@@ -407,7 +479,7 @@ No other changes yet.
407
479
  </details>
408
480
 
409
481
  ```grain
410
- some : (fn: (a => Bool), list: List<a>) => Bool
482
+ some: (fn: (a => Bool), list: List<a>) => Bool
411
483
  ```
412
484
 
413
485
  Checks that the given condition is satisfied **at least
@@ -415,16 +487,16 @@ once** by an element in the input list.
415
487
 
416
488
  Parameters:
417
489
 
418
- |param|type|description|
419
- |-----|----|-----------|
420
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
421
- |`list`|`List<a>`|The list to iterate|
490
+ | param | type | description |
491
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
492
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
493
+ | `list` | `List<a>` | The list to iterate |
422
494
 
423
495
  Returns:
424
496
 
425
- |type|description|
426
- |----|-----------|
427
- |`Bool`|`true` if one or more elements satify the condition or `false` otherwise|
497
+ | type | description |
498
+ | ------ | ------------------------------------------------------------------------- |
499
+ | `Bool` | `true` if one or more elements satisfy the condition or `false` otherwise |
428
500
 
429
501
  ### List.**forEach**
430
502
 
@@ -434,17 +506,17 @@ No other changes yet.
434
506
  </details>
435
507
 
436
508
  ```grain
437
- forEach : (fn: (a => Void), list: List<a>) => Void
509
+ forEach: (fn: (a => Void), list: List<a>) => Void
438
510
  ```
439
511
 
440
512
  Iterates a list, calling an iterator function on each element.
441
513
 
442
514
  Parameters:
443
515
 
444
- |param|type|description|
445
- |-----|----|-----------|
446
- |`fn`|`a => Void`|The iterator function to call with each element|
447
- |`list`|`List<a>`|The list to iterate|
516
+ | param | type | description |
517
+ | ------ | ----------- | ----------------------------------------------- |
518
+ | `fn` | `a => Void` | The iterator function to call with each element |
519
+ | `list` | `List<a>` | The list to iterate |
448
520
 
449
521
  ### List.**forEachi**
450
522
 
@@ -454,7 +526,7 @@ No other changes yet.
454
526
  </details>
455
527
 
456
528
  ```grain
457
- forEachi : (fn: ((a, Number) => Void), list: List<a>) => Void
529
+ forEachi: (fn: ((a, Number) => Void), list: List<a>) => Void
458
530
  ```
459
531
 
460
532
  Iterates a list, calling an iterator function on each element.
@@ -462,10 +534,10 @@ Also passes the index as the second argument to the function.
462
534
 
463
535
  Parameters:
464
536
 
465
- |param|type|description|
466
- |-----|----|-----------|
467
- |`fn`|`(a, Number) => Void`|The iterator function to call with each element|
468
- |`list`|`List<a>`|The list to iterate|
537
+ | param | type | description |
538
+ | ------ | --------------------- | ----------------------------------------------- |
539
+ | `fn` | `(a, Number) => Void` | The iterator function to call with each element |
540
+ | `list` | `List<a>` | The list to iterate |
469
541
 
470
542
  ### List.**filter**
471
543
 
@@ -475,7 +547,7 @@ No other changes yet.
475
547
  </details>
476
548
 
477
549
  ```grain
478
- filter : (fn: (a => Bool), list: List<a>) => List<a>
550
+ filter: (fn: (a => Bool), list: List<a>) => List<a>
479
551
  ```
480
552
 
481
553
  Produces a new list by calling a function on each element of
@@ -484,16 +556,16 @@ the condition.
484
556
 
485
557
  Parameters:
486
558
 
487
- |param|type|description|
488
- |-----|----|-----------|
489
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
490
- |`list`|`List<a>`|The list to iterate|
559
+ | param | type | description |
560
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
561
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
562
+ | `list` | `List<a>` | The list to iterate |
491
563
 
492
564
  Returns:
493
565
 
494
- |type|description|
495
- |----|-----------|
496
- |`List<a>`|The new list containing elements where `fn` returned `true`|
566
+ | type | description |
567
+ | --------- | ----------------------------------------------------------- |
568
+ | `List<a>` | The new list containing elements where `fn` returned `true` |
497
569
 
498
570
  ### List.**filteri**
499
571
 
@@ -503,7 +575,7 @@ No other changes yet.
503
575
  </details>
504
576
 
505
577
  ```grain
506
- filteri : (fn: ((a, Number) => Bool), list: List<a>) => List<a>
578
+ filteri: (fn: ((a, Number) => Bool), list: List<a>) => List<a>
507
579
  ```
508
580
 
509
581
  Produces a new list by calling a function on each element of
@@ -512,16 +584,16 @@ the condition. Also passes the index to the function.
512
584
 
513
585
  Parameters:
514
586
 
515
- |param|type|description|
516
- |-----|----|-----------|
517
- |`fn`|`(a, Number) => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
518
- |`list`|`List<a>`|The list to iterate|
587
+ | param | type | description |
588
+ | ------ | --------------------- | --------------------------------------------------------------------------------------------------------------- |
589
+ | `fn` | `(a, Number) => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
590
+ | `list` | `List<a>` | The list to iterate |
519
591
 
520
592
  Returns:
521
593
 
522
- |type|description|
523
- |----|-----------|
524
- |`List<a>`|The new list containing elements where `fn` returned `true`|
594
+ | type | description |
595
+ | --------- | ----------------------------------------------------------- |
596
+ | `List<a>` | The new list containing elements where `fn` returned `true` |
525
597
 
526
598
  ### List.**reject**
527
599
 
@@ -531,7 +603,7 @@ No other changes yet.
531
603
  </details>
532
604
 
533
605
  ```grain
534
- reject : (fn: (a => Bool), list: List<a>) => List<a>
606
+ reject: (fn: (a => Bool), list: List<a>) => List<a>
535
607
  ```
536
608
 
537
609
  Produces a new list by calling a function on each element of
@@ -540,16 +612,16 @@ the condition.
540
612
 
541
613
  Parameters:
542
614
 
543
- |param|type|description|
544
- |-----|----|-----------|
545
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
546
- |`list`|`List<a>`|The list to iterate|
615
+ | param | type | description |
616
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
617
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
618
+ | `list` | `List<a>` | The list to iterate |
547
619
 
548
620
  Returns:
549
621
 
550
- |type|description|
551
- |----|-----------|
552
- |`List<a>`|The new list containing elements where `fn` returned `false`|
622
+ | type | description |
623
+ | --------- | ------------------------------------------------------------ |
624
+ | `List<a>` | The new list containing elements where `fn` returned `false` |
553
625
 
554
626
  ### List.**head**
555
627
 
@@ -568,7 +640,7 @@ Returns:
568
640
  </details>
569
641
 
570
642
  ```grain
571
- head : (list: List<a>) => Option<a>
643
+ head: (list: List<a>) => Option<a>
572
644
  ```
573
645
 
574
646
  Provides `Some(element)` containing the first element, or "head", of
@@ -576,15 +648,15 @@ the input list or `None` if the list is empty.
576
648
 
577
649
  Parameters:
578
650
 
579
- |param|type|description|
580
- |-----|----|-----------|
581
- |`list`|`List<a>`|The list to access|
651
+ | param | type | description |
652
+ | ------ | --------- | ------------------ |
653
+ | `list` | `List<a>` | The list to access |
582
654
 
583
655
  Returns:
584
656
 
585
- |type|description|
586
- |----|-----------|
587
- |`Option<a>`|`Some(firstElement)` if the list has elements or `None` otherwise|
657
+ | type | description |
658
+ | ----------- | ----------------------------------------------------------------- |
659
+ | `Option<a>` | `Some(firstElement)` if the list has elements or `None` otherwise |
588
660
 
589
661
  ### List.**tail**
590
662
 
@@ -603,7 +675,7 @@ Returns:
603
675
  </details>
604
676
 
605
677
  ```grain
606
- tail : (list: List<a>) => Option<List<a>>
678
+ tail: (list: List<a>) => Option<List<a>>
607
679
  ```
608
680
 
609
681
  Provides `Some(tail)` containing all list items except the first element, or "tail", of
@@ -611,15 +683,15 @@ the input list or `None` if the list is empty.
611
683
 
612
684
  Parameters:
613
685
 
614
- |param|type|description|
615
- |-----|----|-----------|
616
- |`list`|`List<a>`|The list to access|
686
+ | param | type | description |
687
+ | ------ | --------- | ------------------ |
688
+ | `list` | `List<a>` | The list to access |
617
689
 
618
690
  Returns:
619
691
 
620
- |type|description|
621
- |----|-----------|
622
- |`Option<List<a>>`|`Some(tail)` if the list has elements or `None` otherwise|
692
+ | type | description |
693
+ | ----------------- | --------------------------------------------------------- |
694
+ | `Option<List<a>>` | `Some(tail)` if the list has elements or `None` otherwise |
623
695
 
624
696
  ### List.**nth**
625
697
 
@@ -637,7 +709,7 @@ Returns:
637
709
  </details>
638
710
 
639
711
  ```grain
640
- nth : (index: Number, list: List<a>) => Option<a>
712
+ nth: (index: Number, list: List<a>) => Option<a>
641
713
  ```
642
714
 
643
715
  Provides `Some(element)` containing the element in the list at the specified index
@@ -645,16 +717,16 @@ or `None` if the index is out-of-bounds or the list is empty.
645
717
 
646
718
  Parameters:
647
719
 
648
- |param|type|description|
649
- |-----|----|-----------|
650
- |`index`|`Number`|The index to access|
651
- |`list`|`List<a>`|The list to access|
720
+ | param | type | description |
721
+ | ------- | --------- | ------------------- |
722
+ | `index` | `Number` | The index to access |
723
+ | `list` | `List<a>` | The list to access |
652
724
 
653
725
  Returns:
654
726
 
655
- |type|description|
656
- |----|-----------|
657
- |`Option<a>`|`Some(element)` if the list contains an element at the index or `None` otherwise|
727
+ | type | description |
728
+ | ----------- | -------------------------------------------------------------------------------- |
729
+ | `Option<a>` | `Some(element)` if the list contains an element at the index or `None` otherwise |
658
730
 
659
731
  ### List.**flatten**
660
732
 
@@ -664,22 +736,22 @@ No other changes yet.
664
736
  </details>
665
737
 
666
738
  ```grain
667
- flatten : (list: List<List<a>>) => List<a>
739
+ flatten: (list: List<List<a>>) => List<a>
668
740
  ```
669
741
 
670
742
  Flattens nested lists.
671
743
 
672
744
  Parameters:
673
745
 
674
- |param|type|description|
675
- |-----|----|-----------|
676
- |`list`|`List<List<a>>`|The list to flatten|
746
+ | param | type | description |
747
+ | ------ | --------------- | ------------------- |
748
+ | `list` | `List<List<a>>` | The list to flatten |
677
749
 
678
750
  Returns:
679
751
 
680
- |type|description|
681
- |----|-----------|
682
- |`List<a>`|A new list containing all nested list elements combined|
752
+ | type | description |
753
+ | --------- | ------------------------------------------------------- |
754
+ | `List<a>` | A new list containing all nested list elements combined |
683
755
 
684
756
  Examples:
685
757
 
@@ -702,24 +774,24 @@ List.flatten([[1, 2], [3, 4]]) // [1, 2, 3, 4]
702
774
  </details>
703
775
 
704
776
  ```grain
705
- insert : (index: Number, value: a, list: List<a>) => List<a>
777
+ insert: (index: Number, value: a, list: List<a>) => List<a>
706
778
  ```
707
779
 
708
780
  Inserts a new value into a list at the specified index.
709
781
 
710
782
  Parameters:
711
783
 
712
- |param|type|description|
713
- |-----|----|-----------|
714
- |`index`|`Number`|The index to update|
715
- |`value`|`a`|The value to insert|
716
- |`list`|`List<a>`|The list to update|
784
+ | param | type | description |
785
+ | ------- | --------- | ------------------- |
786
+ | `index` | `Number` | The index to update |
787
+ | `value` | `a` | The value to insert |
788
+ | `list` | `List<a>` | The list to update |
717
789
 
718
790
  Returns:
719
791
 
720
- |type|description|
721
- |----|-----------|
722
- |`List<a>`|The new list|
792
+ | type | description |
793
+ | --------- | ------------ |
794
+ | `List<a>` | The new list |
723
795
 
724
796
  Throws:
725
797
 
@@ -743,23 +815,23 @@ Throws:
743
815
  </details>
744
816
 
745
817
  ```grain
746
- count : (fn: (a => Bool), list: List<a>) => Number
818
+ count: (fn: (a => Bool), list: List<a>) => Number
747
819
  ```
748
820
 
749
821
  Counts the number of elements in a list that satisfy the given condition.
750
822
 
751
823
  Parameters:
752
824
 
753
- |param|type|description|
754
- |-----|----|-----------|
755
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
756
- |`list`|`List<a>`|The list to iterate|
825
+ | param | type | description |
826
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
827
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
828
+ | `list` | `List<a>` | The list to iterate |
757
829
 
758
830
  Returns:
759
831
 
760
- |type|description|
761
- |----|-----------|
762
- |`Number`|The total number of elements that satisfy the condition|
832
+ | type | description |
833
+ | -------- | ------------------------------------------------------- |
834
+ | `Number` | The total number of elements that satisfy the condition |
763
835
 
764
836
  ### List.**part**
765
837
 
@@ -769,23 +841,23 @@ No other changes yet.
769
841
  </details>
770
842
 
771
843
  ```grain
772
- part : (count: Number, list: List<a>) => (List<a>, List<a>)
844
+ part: (count: Number, list: List<a>) => (List<a>, List<a>)
773
845
  ```
774
846
 
775
847
  Split a list into two, with the first list containing the required number of elements.
776
848
 
777
849
  Parameters:
778
850
 
779
- |param|type|description|
780
- |-----|----|-----------|
781
- |`count`|`Number`|The number of elements required|
782
- |`list`|`List<a>`|The list to split|
851
+ | param | type | description |
852
+ | ------- | --------- | ------------------------------- |
853
+ | `count` | `Number` | The number of elements required |
854
+ | `list` | `List<a>` | The list to split |
783
855
 
784
856
  Returns:
785
857
 
786
- |type|description|
787
- |----|-----------|
788
- |`(List<a>, List<a>)`|Two lists where the first contains exactly the required amount of elements and the second contains any remaining elements|
858
+ | type | description |
859
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------- |
860
+ | `(List<a>, List<a>)` | Two lists where the first contains exactly the required amount of elements and the second contains any remaining elements |
789
861
 
790
862
  Throws:
791
863
 
@@ -809,7 +881,7 @@ Throws:
809
881
  </details>
810
882
 
811
883
  ```grain
812
- rotate : (n: Number, list: List<a>) => List<a>
884
+ rotate: (n: Number, list: List<a>) => List<a>
813
885
  ```
814
886
 
815
887
  Rotates list elements by the specified amount to the left, such that `n`th
@@ -820,10 +892,10 @@ specified amount to the right. See examples.
820
892
 
821
893
  Parameters:
822
894
 
823
- |param|type|description|
824
- |-----|----|-----------|
825
- |`n`|`Number`|The number of elements to rotate by|
826
- |`list`|`List<a>`|The list to be rotated|
895
+ | param | type | description |
896
+ | ------ | --------- | ----------------------------------- |
897
+ | `n` | `Number` | The number of elements to rotate by |
898
+ | `list` | `List<a>` | The list to be rotated |
827
899
 
828
900
  Examples:
829
901
 
@@ -855,7 +927,7 @@ List.rotate(-7, [1, 2, 3, 4, 5]) // [4, 5, 1, 2, 3]
855
927
  </details>
856
928
 
857
929
  ```grain
858
- unique : (list: List<a>) => List<a>
930
+ unique: (list: List<a>) => List<a>
859
931
  ```
860
932
 
861
933
  Produces a new list with any duplicates removed.
@@ -863,15 +935,15 @@ Uses the generic `==` structural equality operator.
863
935
 
864
936
  Parameters:
865
937
 
866
- |param|type|description|
867
- |-----|----|-----------|
868
- |`list`|`List<a>`|The list to filter|
938
+ | param | type | description |
939
+ | ------ | --------- | ------------------ |
940
+ | `list` | `List<a>` | The list to filter |
869
941
 
870
942
  Returns:
871
943
 
872
- |type|description|
873
- |----|-----------|
874
- |`List<a>`|The new list with only unique values|
944
+ | type | description |
945
+ | --------- | ------------------------------------ |
946
+ | `List<a>` | The new list with only unique values |
875
947
 
876
948
  ### List.**zip**
877
949
 
@@ -881,7 +953,7 @@ No other changes yet.
881
953
  </details>
882
954
 
883
955
  ```grain
884
- zip : (list1: List<a>, list2: List<b>) => List<(a, b)>
956
+ zip: (list1: List<a>, list2: List<b>) => List<(a, b)>
885
957
  ```
886
958
 
887
959
  Produces a new list filled with tuples of elements from both given lists.
@@ -893,16 +965,16 @@ list to have the length of the smaller list.
893
965
 
894
966
  Parameters:
895
967
 
896
- |param|type|description|
897
- |-----|----|-----------|
898
- |`list1`|`List<a>`|The list to provide values for the first tuple element|
899
- |`list2`|`List<b>`|The list to provide values for the second tuple element|
968
+ | param | type | description |
969
+ | ------- | --------- | ------------------------------------------------------- |
970
+ | `list1` | `List<a>` | The list to provide values for the first tuple element |
971
+ | `list2` | `List<b>` | The list to provide values for the second tuple element |
900
972
 
901
973
  Returns:
902
974
 
903
- |type|description|
904
- |----|-----------|
905
- |`List<(a, b)>`|The new list containing indexed pairs of `(a, b)`|
975
+ | type | description |
976
+ | -------------- | ------------------------------------------------- |
977
+ | `List<(a, b)>` | The new list containing indexed pairs of `(a, b)` |
906
978
 
907
979
  Examples:
908
980
 
@@ -922,7 +994,7 @@ No other changes yet.
922
994
  </details>
923
995
 
924
996
  ```grain
925
- zipWith : (fn: ((a, b) => c), list1: List<a>, list2: List<b>) => List<c>
997
+ zipWith: (fn: ((a, b) => c), list1: List<a>, list2: List<b>) => List<c>
926
998
  ```
927
999
 
928
1000
  Produces a new list filled with elements defined by applying a function on
@@ -936,17 +1008,17 @@ list to have the length of the smaller list.
936
1008
 
937
1009
  Parameters:
938
1010
 
939
- |param|type|description|
940
- |-----|----|-----------|
941
- |`fn`|`(a, b) => c`|The function to apply to pairs of elements|
942
- |`list1`|`List<a>`|The list whose elements will each be passed to the function as the first argument|
943
- |`list2`|`List<b>`|The list whose elements will each be passed to the function as the second argument|
1011
+ | param | type | description |
1012
+ | ------- | ------------- | ---------------------------------------------------------------------------------- |
1013
+ | `fn` | `(a, b) => c` | The function to apply to pairs of elements |
1014
+ | `list1` | `List<a>` | The list whose elements will each be passed to the function as the first argument |
1015
+ | `list2` | `List<b>` | The list whose elements will each be passed to the function as the second argument |
944
1016
 
945
1017
  Returns:
946
1018
 
947
- |type|description|
948
- |----|-----------|
949
- |`List<c>`|The new list containing elements derived from applying the function to pairs of input list elements|
1019
+ | type | description |
1020
+ | --------- | --------------------------------------------------------------------------------------------------- |
1021
+ | `List<c>` | The new list containing elements derived from applying the function to pairs of input list elements |
950
1022
 
951
1023
  Examples:
952
1024
 
@@ -966,22 +1038,22 @@ No other changes yet.
966
1038
  </details>
967
1039
 
968
1040
  ```grain
969
- unzip : (list: List<(a, b)>) => (List<a>, List<b>)
1041
+ unzip: (list: List<(a, b)>) => (List<a>, List<b>)
970
1042
  ```
971
1043
 
972
1044
  Produces two lists by splitting apart a list of tuples.
973
1045
 
974
1046
  Parameters:
975
1047
 
976
- |param|type|description|
977
- |-----|----|-----------|
978
- |`list`|`List<(a, b)>`|The list of tuples to split|
1048
+ | param | type | description |
1049
+ | ------ | -------------- | --------------------------- |
1050
+ | `list` | `List<(a, b)>` | The list of tuples to split |
979
1051
 
980
1052
  Returns:
981
1053
 
982
- |type|description|
983
- |----|-----------|
984
- |`(List<a>, List<b>)`|An list containing all elements from the first tuple element, and a list containing all elements from the second tuple element|
1054
+ | type | description |
1055
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
1056
+ | `(List<a>, List<b>)` | An list containing all elements from the first tuple element, and a list containing all elements from the second tuple element |
985
1057
 
986
1058
  ### List.**drop**
987
1059
 
@@ -991,7 +1063,7 @@ No other changes yet.
991
1063
  </details>
992
1064
 
993
1065
  ```grain
994
- drop : (count: Number, list: List<a>) => List<a>
1066
+ drop: (count: Number, list: List<a>) => List<a>
995
1067
  ```
996
1068
 
997
1069
  Produces a new list with the specified number of elements removed from
@@ -999,16 +1071,16 @@ the beginning of the input list.
999
1071
 
1000
1072
  Parameters:
1001
1073
 
1002
- |param|type|description|
1003
- |-----|----|-----------|
1004
- |`count`|`Number`|The amount of elements to remove|
1005
- |`list`|`List<a>`|The input list|
1074
+ | param | type | description |
1075
+ | ------- | --------- | -------------------------------- |
1076
+ | `count` | `Number` | The amount of elements to remove |
1077
+ | `list` | `List<a>` | The input list |
1006
1078
 
1007
1079
  Returns:
1008
1080
 
1009
- |type|description|
1010
- |----|-----------|
1011
- |`List<a>`|The new list without the dropped elements|
1081
+ | type | description |
1082
+ | --------- | ----------------------------------------- |
1083
+ | `List<a>` | The new list without the dropped elements |
1012
1084
 
1013
1085
  Throws:
1014
1086
 
@@ -1024,7 +1096,7 @@ No other changes yet.
1024
1096
  </details>
1025
1097
 
1026
1098
  ```grain
1027
- dropWhile : (fn: (a => Bool), list: List<a>) => List<a>
1099
+ dropWhile: (fn: (a => Bool), list: List<a>) => List<a>
1028
1100
  ```
1029
1101
 
1030
1102
  Produces a new list with the elements removed from the beginning
@@ -1033,16 +1105,16 @@ Stops when the predicate function returns `false`.
1033
1105
 
1034
1106
  Parameters:
1035
1107
 
1036
- |param|type|description|
1037
- |-----|----|-----------|
1038
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
1039
- |`list`|`List<a>`|The input list|
1108
+ | param | type | description |
1109
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
1110
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
1111
+ | `list` | `List<a>` | The input list |
1040
1112
 
1041
1113
  Returns:
1042
1114
 
1043
- |type|description|
1044
- |----|-----------|
1045
- |`List<a>`|The new list without the dropped elements|
1115
+ | type | description |
1116
+ | --------- | ----------------------------------------- |
1117
+ | `List<a>` | The new list without the dropped elements |
1046
1118
 
1047
1119
  ### List.**take**
1048
1120
 
@@ -1052,7 +1124,7 @@ No other changes yet.
1052
1124
  </details>
1053
1125
 
1054
1126
  ```grain
1055
- take : (count: Number, list: List<a>) => List<a>
1127
+ take: (count: Number, list: List<a>) => List<a>
1056
1128
  ```
1057
1129
 
1058
1130
  Produces a new list with–at most—the specified amount elements from
@@ -1060,16 +1132,16 @@ the beginning of the input list.
1060
1132
 
1061
1133
  Parameters:
1062
1134
 
1063
- |param|type|description|
1064
- |-----|----|-----------|
1065
- |`count`|`Number`|The amount of elements to keep|
1066
- |`list`|`List<a>`|The input list|
1135
+ | param | type | description |
1136
+ | ------- | --------- | ------------------------------ |
1137
+ | `count` | `Number` | The amount of elements to keep |
1138
+ | `list` | `List<a>` | The input list |
1067
1139
 
1068
1140
  Returns:
1069
1141
 
1070
- |type|description|
1071
- |----|-----------|
1072
- |`List<a>`|The new list containing the taken elements|
1142
+ | type | description |
1143
+ | --------- | ------------------------------------------ |
1144
+ | `List<a>` | The new list containing the taken elements |
1073
1145
 
1074
1146
  Throws:
1075
1147
 
@@ -1085,7 +1157,7 @@ No other changes yet.
1085
1157
  </details>
1086
1158
 
1087
1159
  ```grain
1088
- takeWhile : (fn: (a => Bool), list: List<a>) => List<a>
1160
+ takeWhile: (fn: (a => Bool), list: List<a>) => List<a>
1089
1161
  ```
1090
1162
 
1091
1163
  Produces a new list with elements from the beginning of the input list
@@ -1094,16 +1166,16 @@ Stops when the predicate function returns `false`.
1094
1166
 
1095
1167
  Parameters:
1096
1168
 
1097
- |param|type|description|
1098
- |-----|----|-----------|
1099
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
1100
- |`list`|`List<a>`|The input list|
1169
+ | param | type | description |
1170
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
1171
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
1172
+ | `list` | `List<a>` | The input list |
1101
1173
 
1102
1174
  Returns:
1103
1175
 
1104
- |type|description|
1105
- |----|-----------|
1106
- |`List<a>`|The new list containing the taken elements|
1176
+ | type | description |
1177
+ | --------- | ------------------------------------------ |
1178
+ | `List<a>` | The new list containing the taken elements |
1107
1179
 
1108
1180
  ### List.**find**
1109
1181
 
@@ -1121,23 +1193,23 @@ Returns:
1121
1193
  </details>
1122
1194
 
1123
1195
  ```grain
1124
- find : (fn: (a => Bool), list: List<a>) => Option<a>
1196
+ find: (fn: (a => Bool), list: List<a>) => Option<a>
1125
1197
  ```
1126
1198
 
1127
- Finds the first element in a list that satifies the given condition.
1199
+ Finds the first element in a list that satisfies the given condition.
1128
1200
 
1129
1201
  Parameters:
1130
1202
 
1131
- |param|type|description|
1132
- |-----|----|-----------|
1133
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
1134
- |`list`|`List<a>`|The list to search|
1203
+ | param | type | description |
1204
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
1205
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
1206
+ | `list` | `List<a>` | The list to search |
1135
1207
 
1136
1208
  Returns:
1137
1209
 
1138
- |type|description|
1139
- |----|-----------|
1140
- |`Option<a>`|`Some(element)` containing the first value found or `None` otherwise|
1210
+ | type | description |
1211
+ | ----------- | -------------------------------------------------------------------- |
1212
+ | `Option<a>` | `Some(element)` containing the first value found or `None` otherwise |
1141
1213
 
1142
1214
  ### List.**findIndex**
1143
1215
 
@@ -1155,23 +1227,58 @@ Returns:
1155
1227
  </details>
1156
1228
 
1157
1229
  ```grain
1158
- findIndex : (fn: (a => Bool), list: List<a>) => Option<Number>
1230
+ findIndex: (fn: (a => Bool), list: List<a>) => Option<Number>
1159
1231
  ```
1160
1232
 
1161
- Finds the first index in a list where the element satifies the given condition.
1233
+ Finds the first index in a list where the element satisfies the given condition.
1162
1234
 
1163
1235
  Parameters:
1164
1236
 
1165
- |param|type|description|
1166
- |-----|----|-----------|
1167
- |`fn`|`a => Bool`|The function to call on each element, where the returned value indicates if the element satisfies the condition|
1168
- |`list`|`List<a>`|The list to search|
1237
+ | param | type | description |
1238
+ | ------ | ----------- | --------------------------------------------------------------------------------------------------------------- |
1239
+ | `fn` | `a => Bool` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
1240
+ | `list` | `List<a>` | The list to search |
1169
1241
 
1170
1242
  Returns:
1171
1243
 
1172
- |type|description|
1173
- |----|-----------|
1174
- |`Option<Number>`|`Some(index)` containing the index of the first element found or `None` otherwise|
1244
+ | type | description |
1245
+ | ---------------- | --------------------------------------------------------------------------------- |
1246
+ | `Option<Number>` | `Some(index)` containing the index of the first element found or `None` otherwise |
1247
+
1248
+ ### List.**findMap**
1249
+
1250
+ <details disabled>
1251
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1252
+ No other changes yet.
1253
+ </details>
1254
+
1255
+ ```grain
1256
+ findMap: (fn: (a => Option<b>), list: List<a>) => Option<b>
1257
+ ```
1258
+
1259
+ Finds the first element in a list that satisfies the given condition and
1260
+ returns the result of applying a mapper function to it.
1261
+
1262
+ Parameters:
1263
+
1264
+ | param | type | description |
1265
+ | ------ | ---------------- | --------------------------------------------------------------------------------------------------------------- |
1266
+ | `fn` | `a => Option<b>` | The function to call on each element, where the returned value indicates if the element satisfies the condition |
1267
+ | `list` | `List<a>` | The list to search |
1268
+
1269
+ Returns:
1270
+
1271
+ | type | description |
1272
+ | ----------- | ------------------------------------------------------------------------------------------ |
1273
+ | `Option<b>` | `Some(mapped)` containing the first value found with the given mapping or `None` otherwise |
1274
+
1275
+ Examples:
1276
+
1277
+ ```grain
1278
+ let jsonObject = [(1, 'a'), (2, 'b'), (1, 'c')]
1279
+ let getItem = (key, obj) => List.findMap(((k, v)) => if (k == key) Some(v) else None, obj)
1280
+ assert getItem(1, jsonObject) == Some('a')
1281
+ ```
1175
1282
 
1176
1283
  ### List.**product**
1177
1284
 
@@ -1181,7 +1288,7 @@ No other changes yet.
1181
1288
  </details>
1182
1289
 
1183
1290
  ```grain
1184
- product : (list1: List<a>, list2: List<b>) => List<(a, b)>
1291
+ product: (list1: List<a>, list2: List<b>) => List<(a, b)>
1185
1292
  ```
1186
1293
 
1187
1294
  Combines two lists into a Cartesian product of tuples containing
@@ -1189,16 +1296,16 @@ all ordered pairs `(a, b)`.
1189
1296
 
1190
1297
  Parameters:
1191
1298
 
1192
- |param|type|description|
1193
- |-----|----|-----------|
1194
- |`list1`|`List<a>`|The list to provide values for the first tuple element|
1195
- |`list2`|`List<b>`|The list to provide values for the second tuple element|
1299
+ | param | type | description |
1300
+ | ------- | --------- | ------------------------------------------------------- |
1301
+ | `list1` | `List<a>` | The list to provide values for the first tuple element |
1302
+ | `list2` | `List<b>` | The list to provide values for the second tuple element |
1196
1303
 
1197
1304
  Returns:
1198
1305
 
1199
- |type|description|
1200
- |----|-----------|
1201
- |`List<(a, b)>`|The new list containing all pairs of `(a, b)`|
1306
+ | type | description |
1307
+ | -------------- | --------------------------------------------- |
1308
+ | `List<(a, b)>` | The new list containing all pairs of `(a, b)` |
1202
1309
 
1203
1310
  ### List.**sub**
1204
1311
 
@@ -1208,7 +1315,7 @@ No other changes yet.
1208
1315
  </details>
1209
1316
 
1210
1317
  ```grain
1211
- sub : (start: Number, length: Number, list: List<a>) => List<a>
1318
+ sub: (start: Number, length: Number, list: List<a>) => List<a>
1212
1319
  ```
1213
1320
 
1214
1321
  Provides the subset of a list given zero-based start index and amount of elements
@@ -1216,17 +1323,17 @@ to include.
1216
1323
 
1217
1324
  Parameters:
1218
1325
 
1219
- |param|type|description|
1220
- |-----|----|-----------|
1221
- |`start`|`Number`|The index of the list where the subset will begin (inclusive)|
1222
- |`length`|`Number`|The amount of elements to be included in the subset|
1223
- |`list`|`List<a>`|The input list|
1326
+ | param | type | description |
1327
+ | -------- | --------- | ------------------------------------------------------------- |
1328
+ | `start` | `Number` | The index of the list where the subset will begin (inclusive) |
1329
+ | `length` | `Number` | The amount of elements to be included in the subset |
1330
+ | `list` | `List<a>` | The input list |
1224
1331
 
1225
1332
  Returns:
1226
1333
 
1227
- |type|description|
1228
- |----|-----------|
1229
- |`List<a>`|The subset of the list|
1334
+ | type | description |
1335
+ | --------- | ---------------------- |
1336
+ | `List<a>` | The subset of the list |
1230
1337
 
1231
1338
  Throws:
1232
1339
 
@@ -1243,7 +1350,7 @@ No other changes yet.
1243
1350
  </details>
1244
1351
 
1245
1352
  ```grain
1246
- join : (separator: String, list: List<String>) => String
1353
+ join: (separator: String, list: List<String>) => String
1247
1354
  ```
1248
1355
 
1249
1356
  Combine the given list of strings into one string with the specified
@@ -1251,16 +1358,16 @@ separator inserted between each item.
1251
1358
 
1252
1359
  Parameters:
1253
1360
 
1254
- |param|type|description|
1255
- |-----|----|-----------|
1256
- |`separator`|`String`|The separator to insert between elements|
1257
- |`list`|`List<String>`|The list to combine|
1361
+ | param | type | description |
1362
+ | ----------- | -------------- | ---------------------------------------- |
1363
+ | `separator` | `String` | The separator to insert between elements |
1364
+ | `list` | `List<String>` | The list to combine |
1258
1365
 
1259
1366
  Returns:
1260
1367
 
1261
- |type|description|
1262
- |----|-----------|
1263
- |`String`|The combined elements with the separator between each|
1368
+ | type | description |
1369
+ | -------- | ----------------------------------------------------- |
1370
+ | `String` | The combined elements with the separator between each |
1264
1371
 
1265
1372
  ### List.**revAppend**
1266
1373
 
@@ -1270,23 +1377,23 @@ No other changes yet.
1270
1377
  </details>
1271
1378
 
1272
1379
  ```grain
1273
- revAppend : (list1: List<a>, list2: List<a>) => List<a>
1380
+ revAppend: (list1: List<a>, list2: List<a>) => List<a>
1274
1381
  ```
1275
1382
 
1276
1383
  Reverses the first list and appends the second list to the end.
1277
1384
 
1278
1385
  Parameters:
1279
1386
 
1280
- |param|type|description|
1281
- |-----|----|-----------|
1282
- |`list1`|`List<a>`|The list to reverse|
1283
- |`list2`|`List<a>`|The list to append|
1387
+ | param | type | description |
1388
+ | ------- | --------- | ------------------- |
1389
+ | `list1` | `List<a>` | The list to reverse |
1390
+ | `list2` | `List<a>` | The list to append |
1284
1391
 
1285
1392
  Returns:
1286
1393
 
1287
- |type|description|
1288
- |----|-----------|
1289
- |`List<a>`|The new list|
1394
+ | type | description |
1395
+ | --------- | ------------ |
1396
+ | `List<a>` | The new list |
1290
1397
 
1291
1398
  ### List.**sort**
1292
1399
 
@@ -1303,7 +1410,7 @@ Returns:
1303
1410
  </details>
1304
1411
 
1305
1412
  ```grain
1306
- sort : (?compare: ((num1: a, num2: a) => Number), list: List<a>) => List<a>
1413
+ sort: (?compare: ((num1: a, num2: a) => Number), list: List<a>) => List<a>
1307
1414
  ```
1308
1415
 
1309
1416
  Sorts the given list based on a given comparator function. The resulting list is sorted in increasing order.
@@ -1312,14 +1419,330 @@ Ordering is calculated using a comparator function which takes two list elements
1312
1419
 
1313
1420
  Parameters:
1314
1421
 
1315
- |param|type|description|
1316
- |-----|----|-----------|
1317
- |`?compare`|`(num1: a, num2: a) => Number`|The comparator function used to indicate sort order|
1318
- |`list`|`List<a>`|The list to be sorted|
1422
+ | param | type | description |
1423
+ | ---------- | ------------------------------ | --------------------------------------------------- |
1424
+ | `?compare` | `(num1: a, num2: a) => Number` | The comparator function used to indicate sort order |
1425
+ | `list` | `List<a>` | The list to be sorted |
1319
1426
 
1320
1427
  Returns:
1321
1428
 
1322
- |type|description|
1323
- |----|-----------|
1324
- |`List<a>`|The sorted list|
1429
+ | type | description |
1430
+ | --------- | --------------- |
1431
+ | `List<a>` | The sorted list |
1432
+
1433
+ ## List.Associative
1434
+
1435
+ Utilities for working with lists of key-key value pairs.
1436
+
1437
+ <details disabled>
1438
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1439
+ No other changes yet.
1440
+ </details>
1441
+
1442
+ ```grain
1443
+ let data = [
1444
+ ("name", "Alice"),
1445
+ ("age", "30"),
1446
+ ]
1447
+ assert List.Associative.get("name", data) == Some("Alice")
1448
+ ```
1449
+
1450
+ ### Values
1451
+
1452
+ Functions and constants included in the List.Associative module.
1453
+
1454
+ #### List.Associative.**has**
1455
+
1456
+ <details disabled>
1457
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1458
+ No other changes yet.
1459
+ </details>
1460
+
1461
+ ```grain
1462
+ has: (key: a, list: List<(a, b)>) => Bool
1463
+ ```
1464
+
1465
+ Checks if the given key is present in the list of key-value pairs.
1466
+
1467
+ Parameters:
1468
+
1469
+ | param | type | description |
1470
+ | ------ | -------------- | --------------------------- |
1471
+ | `key` | `a` | The key to search for |
1472
+ | `list` | `List<(a, b)>` | The list of key-value pairs |
1473
+
1474
+ Returns:
1475
+
1476
+ | type | description |
1477
+ | ------ | ----------------------------------------------- |
1478
+ | `Bool` | `true` if the key is found or `false` otherwise |
1479
+
1480
+ Examples:
1481
+
1482
+ ```grain
1483
+ let data = [
1484
+ ("name", "Alice"),
1485
+ ("age", "30"),
1486
+ ]
1487
+ assert List.Associative.has("name", data) == true
1488
+ ```
1489
+
1490
+ ```grain
1491
+ List.Associative.has("age", []) == false
1492
+ ```
1493
+
1494
+ #### List.Associative.**get**
1495
+
1496
+ <details disabled>
1497
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1498
+ No other changes yet.
1499
+ </details>
1500
+
1501
+ ```grain
1502
+ get: (key: a, list: List<(a, b)>) => Option<b>
1503
+ ```
1504
+
1505
+ Retrieves the first value in the list of key-value pairs that matches the given key.
1506
+
1507
+ Parameters:
1508
+
1509
+ | param | type | description |
1510
+ | ------ | -------------- | --------------------------- |
1511
+ | `key` | `a` | The key to search for |
1512
+ | `list` | `List<(a, b)>` | The list of key-value pairs |
1513
+
1514
+ Returns:
1515
+
1516
+ | type | description |
1517
+ | ----------- | ----------------------------------------------------- |
1518
+ | `Option<b>` | `Some(value)` if the key is found or `None` otherwise |
1519
+
1520
+ Examples:
1521
+
1522
+ ```grain
1523
+ let data = [
1524
+ ("name", "Alice"),
1525
+ ("name", "Bob"),
1526
+ ("age", "30"),
1527
+ ]
1528
+ assert List.Associative.get("name", data) == Some("Alice")
1529
+ ```
1530
+
1531
+ ```grain
1532
+ List.Associative.get("age", []) == None
1533
+ ```
1534
+
1535
+ #### List.Associative.**getAll**
1536
+
1537
+ <details disabled>
1538
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1539
+ No other changes yet.
1540
+ </details>
1541
+
1542
+ ```grain
1543
+ getAll: (key: a, list: List<(a, b)>) => List<b>
1544
+ ```
1545
+
1546
+ Retrieves all values in the list of key-value pairs that match the given key.
1547
+
1548
+ Parameters:
1549
+
1550
+ | param | type | description |
1551
+ | ------ | -------------- | --------------------------- |
1552
+ | `key` | `a` | The key to search for |
1553
+ | `list` | `List<(a, b)>` | The list of key-value pairs |
1554
+
1555
+ Returns:
1556
+
1557
+ | type | description |
1558
+ | --------- | ----------------------------------------- |
1559
+ | `List<b>` | An array of values matching the given key |
1560
+
1561
+ Examples:
1562
+
1563
+ ```grain
1564
+ let data = [
1565
+ ("name", "Alice"),
1566
+ ("name", "Bob"),
1567
+ ("age", "30"),
1568
+ ]
1569
+ assert List.Associative.getAll("name", data) == [
1570
+ "Alice",
1571
+ "Bob"
1572
+ ]
1573
+ ```
1574
+
1575
+ ```grain
1576
+ List.Associative.getAll("age", []) == []
1577
+ ```
1578
+
1579
+ #### List.Associative.**set**
1580
+
1581
+ <details disabled>
1582
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1583
+ No other changes yet.
1584
+ </details>
1585
+
1586
+ ```grain
1587
+ set: (key: a, value: b, list: List<(a, b)>) => List<(a, b)>
1588
+ ```
1589
+
1590
+ Creates a new list with the first value in the list of key-value pairs that matches the key replaced.
1591
+ If the key is not found the item is appended to the list.
1592
+
1593
+ Parameters:
1594
+
1595
+ | param | type | description |
1596
+ | ------- | -------------- | --------------------------- |
1597
+ | `key` | `a` | The key to replace |
1598
+ | `value` | `b` | The new value to set |
1599
+ | `list` | `List<(a, b)>` | The list of key-value pairs |
1600
+
1601
+ Returns:
1602
+
1603
+ | type | description |
1604
+ | -------------- | ------------------------------------------- |
1605
+ | `List<(a, b)>` | A new list with the key-value pair replaced |
1606
+
1607
+ Examples:
1608
+
1609
+ ```grain
1610
+ let data = [
1611
+ ("name", "Alice"),
1612
+ ("name", "Bob"),
1613
+ ("age", "30"),
1614
+ ]
1615
+ assert List.Associative.set("name", "Charlie", data) == [("name", "Charlie"), ("name", "Bob"), ("age", "30")]
1616
+ ```
1617
+
1618
+ ```grain
1619
+ List.Associative.set("age", "30", [("name", "Alice")]) == [("name", "Alice"), ("age", "30")]
1620
+ ```
1621
+
1622
+ #### List.Associative.**setAll**
1623
+
1624
+ <details disabled>
1625
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1626
+ No other changes yet.
1627
+ </details>
1628
+
1629
+ ```grain
1630
+ setAll: (key: a, value: b, list: List<(a, b)>) => List<(a, b)>
1631
+ ```
1632
+
1633
+ Creates a new list with all values in the list of key-value pairs that match the key replaced.
1634
+ If the key is not found the item is appended to the list.
1635
+
1636
+ Parameters:
1637
+
1638
+ | param | type | description |
1639
+ | ------- | -------------- | --------------------------- |
1640
+ | `key` | `a` | The key to replace |
1641
+ | `value` | `b` | The new value to set |
1642
+ | `list` | `List<(a, b)>` | The list of key-value pairs |
1643
+
1644
+ Returns:
1645
+
1646
+ | type | description |
1647
+ | -------------- | -------------------------------------------- |
1648
+ | `List<(a, b)>` | A new list with the key-value pairs replaced |
1649
+
1650
+ Examples:
1651
+
1652
+ ```grain
1653
+ let data = [
1654
+ ("name", "Alice"),
1655
+ ("name", "Bob"),
1656
+ ("age", "30"),
1657
+ ]
1658
+ assert List.Associative.setAll("name", "Charlie", data) == [("name", "Charlie"), ("name", "Charlie"), ("age", "30")]
1659
+ ```
1660
+
1661
+ ```grain
1662
+ List.Associative.setAll("age", "30", [("name", "Alice")]) == [("name", "Alice"), ("age", "30")]
1663
+ ```
1664
+
1665
+ #### List.Associative.**remove**
1666
+
1667
+ <details disabled>
1668
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1669
+ No other changes yet.
1670
+ </details>
1671
+
1672
+ ```grain
1673
+ remove: (key: a, list: List<(a, b)>) => List<(a, b)>
1674
+ ```
1675
+
1676
+ Creates a new list with the first value in the list of key-value pairs that matches the key removed.
1677
+ If the key is not found, the list is returned unchanged.
1678
+
1679
+ Parameters:
1680
+
1681
+ | param | type | description |
1682
+ | ------ | -------------- | --------------------------- |
1683
+ | `key` | `a` | The key to remove |
1684
+ | `list` | `List<(a, b)>` | The list of key-value pairs |
1685
+
1686
+ Returns:
1687
+
1688
+ | type | description |
1689
+ | -------------- | -------------------------------------------- |
1690
+ | `List<(a, b)>` | The new list with the key-value pair removed |
1691
+
1692
+ Examples:
1693
+
1694
+ ```grain
1695
+ let data = [
1696
+ ("name", "Alice"),
1697
+ ("name", "Bob"),
1698
+ ("age", "30"),
1699
+ ]
1700
+ assert List.Associative.remove("name", data) == [("name", "Bob"), ("age", "30")]
1701
+ ```
1702
+
1703
+ ```grain
1704
+ List.Associative.remove("age", [("name", "Alice")]) == []
1705
+ ```
1706
+
1707
+ #### List.Associative.**removeAll**
1708
+
1709
+ <details disabled>
1710
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1711
+ No other changes yet.
1712
+ </details>
1713
+
1714
+ ```grain
1715
+ removeAll: (key: a, list: List<(a, b)>) => List<(a, b)>
1716
+ ```
1717
+
1718
+ Creates a new list with all values in the list of key-value pairs matching the key removed.
1719
+ If the key is not found, the list is returned unchanged.
1720
+
1721
+ Parameters:
1722
+
1723
+ | param | type | description |
1724
+ | ------ | -------------- | --------------------------- |
1725
+ | `key` | `a` | The key to remove |
1726
+ | `list` | `List<(a, b)>` | The list of key-value pairs |
1727
+
1728
+ Returns:
1729
+
1730
+ | type | description |
1731
+ | -------------- | --------------------------------------------- |
1732
+ | `List<(a, b)>` | The new list with the key-value pairs removed |
1733
+
1734
+ Examples:
1735
+
1736
+ ```grain
1737
+ let data = [
1738
+ ("name", "Alice"),
1739
+ ("name", "Bob"),
1740
+ ("age", "30"),
1741
+ ]
1742
+ assert List.Associative.removeAll("name", data) == [("age", "30")]
1743
+ ```
1744
+
1745
+ ```grain
1746
+ List.Associative.removeAll("age", [("name", "Alice")]) == [("name", "Alice")]
1747
+ ```
1325
1748