@grain/stdlib 0.5.13 → 0.6.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 +201 -0
- package/LICENSE +1 -1
- package/README.md +25 -2
- package/array.gr +1512 -199
- package/array.md +2032 -94
- package/bigint.gr +239 -140
- package/bigint.md +450 -106
- package/buffer.gr +595 -102
- package/buffer.md +903 -145
- package/bytes.gr +401 -110
- package/bytes.md +551 -63
- package/char.gr +228 -49
- package/char.md +373 -7
- package/exception.gr +26 -12
- package/exception.md +29 -5
- package/float32.gr +130 -109
- package/float32.md +185 -57
- package/float64.gr +112 -99
- package/float64.md +185 -57
- package/hash.gr +62 -40
- package/hash.md +27 -3
- package/int16.gr +430 -0
- package/int16.md +618 -0
- package/int32.gr +200 -269
- package/int32.md +254 -289
- package/int64.gr +142 -225
- package/int64.md +254 -289
- package/int8.gr +511 -0
- package/int8.md +786 -0
- package/json.gr +2071 -0
- package/json.md +646 -0
- package/list.gr +120 -68
- package/list.md +125 -80
- package/map.gr +560 -57
- package/map.md +672 -56
- package/marshal.gr +239 -227
- package/marshal.md +36 -4
- package/number.gr +626 -676
- package/number.md +738 -153
- package/option.gr +33 -35
- package/option.md +58 -42
- package/package.json +2 -2
- package/path.gr +148 -187
- package/path.md +47 -96
- package/pervasives.gr +75 -416
- package/pervasives.md +85 -180
- package/priorityqueue.gr +433 -74
- package/priorityqueue.md +422 -54
- package/queue.gr +362 -80
- package/queue.md +433 -38
- package/random.gr +67 -75
- package/random.md +68 -40
- package/range.gr +135 -63
- package/range.md +198 -43
- package/rational.gr +284 -0
- package/rational.md +545 -0
- package/regex.gr +933 -1066
- package/regex.md +59 -60
- package/result.gr +23 -25
- package/result.md +54 -39
- package/runtime/atof/common.gr +78 -82
- package/runtime/atof/common.md +22 -10
- package/runtime/atof/decimal.gr +102 -127
- package/runtime/atof/decimal.md +28 -7
- package/runtime/atof/lemire.gr +56 -71
- package/runtime/atof/lemire.md +9 -1
- package/runtime/atof/parse.gr +83 -110
- package/runtime/atof/parse.md +12 -2
- package/runtime/atof/slow.gr +28 -35
- package/runtime/atof/slow.md +9 -1
- package/runtime/atof/table.gr +19 -18
- package/runtime/atof/table.md +10 -2
- package/runtime/atoi/parse.gr +153 -136
- package/runtime/atoi/parse.md +50 -1
- package/runtime/bigint.gr +410 -517
- package/runtime/bigint.md +71 -57
- package/runtime/compare.gr +176 -85
- package/runtime/compare.md +31 -1
- package/runtime/dataStructures.gr +144 -32
- package/runtime/dataStructures.md +267 -31
- package/runtime/debugPrint.gr +34 -15
- package/runtime/debugPrint.md +37 -5
- package/runtime/equal.gr +53 -52
- package/runtime/equal.md +30 -1
- package/runtime/exception.gr +38 -47
- package/runtime/exception.md +10 -8
- package/runtime/gc.gr +23 -152
- package/runtime/gc.md +13 -17
- package/runtime/malloc.gr +31 -31
- package/runtime/malloc.md +11 -3
- package/runtime/numberUtils.gr +193 -174
- package/runtime/numberUtils.md +29 -9
- package/runtime/numbers.gr +1695 -1021
- package/runtime/numbers.md +1098 -134
- package/runtime/string.gr +543 -245
- package/runtime/string.md +76 -6
- package/runtime/unsafe/constants.gr +30 -13
- package/runtime/unsafe/constants.md +80 -0
- package/runtime/unsafe/conv.gr +55 -28
- package/runtime/unsafe/conv.md +41 -9
- package/runtime/unsafe/memory.gr +10 -30
- package/runtime/unsafe/memory.md +15 -19
- package/runtime/unsafe/tags.gr +37 -21
- package/runtime/unsafe/tags.md +88 -8
- package/runtime/unsafe/wasmf32.gr +30 -36
- package/runtime/unsafe/wasmf32.md +64 -56
- package/runtime/unsafe/wasmf64.gr +30 -36
- package/runtime/unsafe/wasmf64.md +64 -56
- package/runtime/unsafe/wasmi32.gr +49 -66
- package/runtime/unsafe/wasmi32.md +102 -94
- package/runtime/unsafe/wasmi64.gr +52 -79
- package/runtime/unsafe/wasmi64.md +108 -100
- package/runtime/utils/printing.gr +13 -15
- package/runtime/utils/printing.md +11 -3
- package/runtime/wasi.gr +294 -295
- package/runtime/wasi.md +62 -42
- package/set.gr +574 -64
- package/set.md +634 -54
- package/stack.gr +181 -64
- package/stack.md +271 -42
- package/string.gr +453 -533
- package/string.md +241 -151
- package/uint16.gr +369 -0
- package/uint16.md +585 -0
- package/uint32.gr +470 -0
- package/uint32.md +737 -0
- package/uint64.gr +471 -0
- package/uint64.md +737 -0
- package/uint8.gr +369 -0
- package/uint8.md +585 -0
- package/uri.gr +1093 -0
- package/uri.md +477 -0
- package/{sys → wasi}/file.gr +914 -500
- package/{sys → wasi}/file.md +454 -50
- package/wasi/process.gr +292 -0
- package/{sys → wasi}/process.md +164 -6
- package/wasi/random.gr +77 -0
- package/wasi/random.md +80 -0
- package/{sys → wasi}/time.gr +15 -22
- package/{sys → wasi}/time.md +5 -5
- package/immutablearray.gr +0 -929
- package/immutablearray.md +0 -1038
- package/immutablemap.gr +0 -493
- package/immutablemap.md +0 -479
- package/immutablepriorityqueue.gr +0 -360
- package/immutablepriorityqueue.md +0 -291
- package/immutableset.gr +0 -498
- package/immutableset.md +0 -449
- package/runtime/debug.gr +0 -2
- package/runtime/debug.md +0 -6
- package/runtime/unsafe/errors.gr +0 -36
- package/runtime/unsafe/errors.md +0 -204
- package/sys/process.gr +0 -254
- package/sys/random.gr +0 -79
- package/sys/random.md +0 -66
package/stack.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
title: Stack
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A stack is a LIFO (last-in-first-out) data structure where new
|
|
6
|
+
values are added, retrieved, and removed from the end.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
The default implementation is mutable, but an immutable stack
|
|
9
|
+
implementation is available in the `Immutable` submodule.
|
|
8
10
|
|
|
9
11
|
<details disabled>
|
|
10
12
|
<summary tabindex="-1">Added in <code>0.3.0</code></summary>
|
|
@@ -12,7 +14,7 @@ No other changes yet.
|
|
|
12
14
|
</details>
|
|
13
15
|
|
|
14
16
|
```grain
|
|
15
|
-
|
|
17
|
+
from "stack" include Stack
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
## Types
|
|
@@ -25,55 +27,260 @@ Type declarations included in the Stack module.
|
|
|
25
27
|
type Stack<a>
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
A mutable LIFO (last-in-first-out) data structure.
|
|
29
31
|
|
|
30
32
|
## Values
|
|
31
33
|
|
|
32
34
|
Functions and constants included in the Stack module.
|
|
33
35
|
|
|
34
|
-
### Stack.**
|
|
36
|
+
### Stack.**make**
|
|
35
37
|
|
|
36
38
|
<details disabled>
|
|
37
|
-
<summary tabindex="-1">Added in <code>0.
|
|
39
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
38
40
|
No other changes yet.
|
|
39
41
|
</details>
|
|
40
42
|
|
|
41
43
|
```grain
|
|
42
|
-
|
|
44
|
+
make : (?size: Number) => Stack<a>
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
Creates a new stack with an initial storage of the given size. As values are
|
|
48
|
+
added or removed, the internal storage may grow or shrink. Generally, you
|
|
49
|
+
won’t need to care about the storage size of your map and can use the
|
|
50
|
+
default size.
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
Parameters:
|
|
53
|
+
|
|
54
|
+
|param|type|description|
|
|
55
|
+
|-----|----|-----------|
|
|
56
|
+
|`?size`|`Number`|The initial storage size of the stack|
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
Returns:
|
|
59
|
+
|
|
60
|
+
|type|description|
|
|
61
|
+
|----|-----------|
|
|
62
|
+
|`Stack<a>`|An empty stack|
|
|
63
|
+
|
|
64
|
+
### Stack.**isEmpty**
|
|
50
65
|
|
|
51
66
|
<details disabled>
|
|
52
|
-
<summary tabindex="-1">Added in <code>0.
|
|
67
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
53
68
|
No other changes yet.
|
|
54
69
|
</details>
|
|
55
70
|
|
|
56
71
|
```grain
|
|
57
|
-
|
|
72
|
+
isEmpty : (stack: Stack<a>) => Bool
|
|
58
73
|
```
|
|
59
74
|
|
|
60
|
-
|
|
75
|
+
Checks if the given stack contains no items.
|
|
76
|
+
|
|
77
|
+
Parameters:
|
|
78
|
+
|
|
79
|
+
|param|type|description|
|
|
80
|
+
|-----|----|-----------|
|
|
81
|
+
|`stack`|`Stack<a>`|The stack to check|
|
|
61
82
|
|
|
62
83
|
Returns:
|
|
63
84
|
|
|
64
85
|
|type|description|
|
|
65
86
|
|----|-----------|
|
|
66
|
-
|`
|
|
87
|
+
|`Bool`|`true` if the stack has no items or `false` otherwise|
|
|
67
88
|
|
|
68
|
-
### Stack.**
|
|
89
|
+
### Stack.**size**
|
|
69
90
|
|
|
70
91
|
<details disabled>
|
|
71
|
-
<summary tabindex="-1">Added in <code>0.
|
|
92
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
93
|
+
No other changes yet.
|
|
94
|
+
</details>
|
|
95
|
+
|
|
96
|
+
```grain
|
|
97
|
+
size : (stack: Stack<a>) => Number
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Computes the size of the input stack.
|
|
101
|
+
|
|
102
|
+
Parameters:
|
|
103
|
+
|
|
104
|
+
|param|type|description|
|
|
105
|
+
|-----|----|-----------|
|
|
106
|
+
|`stack`|`Stack<a>`|The stack to inspect|
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
|
|
110
|
+
|type|description|
|
|
111
|
+
|----|-----------|
|
|
112
|
+
|`Number`|The count of the items in the stack|
|
|
113
|
+
|
|
114
|
+
### Stack.**peek**
|
|
115
|
+
|
|
116
|
+
<details disabled>
|
|
117
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
118
|
+
No other changes yet.
|
|
119
|
+
</details>
|
|
120
|
+
|
|
121
|
+
```grain
|
|
122
|
+
peek : (stack: Stack<a>) => Option<a>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Provides the value at the top of the stack, if it exists.
|
|
126
|
+
|
|
127
|
+
Parameters:
|
|
128
|
+
|
|
129
|
+
|param|type|description|
|
|
130
|
+
|-----|----|-----------|
|
|
131
|
+
|`stack`|`Stack<a>`|The stack to inspect|
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
|
|
135
|
+
|type|description|
|
|
136
|
+
|----|-----------|
|
|
137
|
+
|`Option<a>`|`Some(value)` containing the value at the top of the stack or `None` otherwise.|
|
|
138
|
+
|
|
139
|
+
### Stack.**push**
|
|
140
|
+
|
|
141
|
+
<details disabled>
|
|
142
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
72
143
|
No other changes yet.
|
|
73
144
|
</details>
|
|
74
145
|
|
|
75
146
|
```grain
|
|
76
|
-
|
|
147
|
+
push : (value: a, stack: Stack<a>) => Void
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Adds a new item to the top of the stack.
|
|
151
|
+
|
|
152
|
+
Parameters:
|
|
153
|
+
|
|
154
|
+
|param|type|description|
|
|
155
|
+
|-----|----|-----------|
|
|
156
|
+
|`value`|`a`|The item to be added|
|
|
157
|
+
|`stack`|`Stack<a>`|The stack being updated|
|
|
158
|
+
|
|
159
|
+
### Stack.**pop**
|
|
160
|
+
|
|
161
|
+
<details disabled>
|
|
162
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
163
|
+
No other changes yet.
|
|
164
|
+
</details>
|
|
165
|
+
|
|
166
|
+
```grain
|
|
167
|
+
pop : (stack: Stack<a>) => Option<a>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Removes the item at the top of the stack.
|
|
171
|
+
|
|
172
|
+
Parameters:
|
|
173
|
+
|
|
174
|
+
|param|type|description|
|
|
175
|
+
|-----|----|-----------|
|
|
176
|
+
|`stack`|`Stack<a>`|The stack being updated|
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
|
|
180
|
+
|type|description|
|
|
181
|
+
|----|-----------|
|
|
182
|
+
|`Option<a>`|The element removed from the stack|
|
|
183
|
+
|
|
184
|
+
### Stack.**clear**
|
|
185
|
+
|
|
186
|
+
<details disabled>
|
|
187
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
188
|
+
No other changes yet.
|
|
189
|
+
</details>
|
|
190
|
+
|
|
191
|
+
```grain
|
|
192
|
+
clear : (stack: Stack<a>) => Void
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Clears the stack by removing all of its elements
|
|
196
|
+
|
|
197
|
+
Parameters:
|
|
198
|
+
|
|
199
|
+
|param|type|description|
|
|
200
|
+
|-----|----|-----------|
|
|
201
|
+
|`stack`|`Stack<a>`|The stack to clear|
|
|
202
|
+
|
|
203
|
+
### Stack.**copy**
|
|
204
|
+
|
|
205
|
+
<details disabled>
|
|
206
|
+
<summary tabindex="-1">Added in <code>0.6.0</code></summary>
|
|
207
|
+
No other changes yet.
|
|
208
|
+
</details>
|
|
209
|
+
|
|
210
|
+
```grain
|
|
211
|
+
copy : (stack: Stack<a>) => Stack<a>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Produces a shallow copy of the input stack.
|
|
215
|
+
|
|
216
|
+
Parameters:
|
|
217
|
+
|
|
218
|
+
|param|type|description|
|
|
219
|
+
|-----|----|-----------|
|
|
220
|
+
|`stack`|`Stack<a>`|The stack to copy|
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
|
|
224
|
+
|type|description|
|
|
225
|
+
|----|-----------|
|
|
226
|
+
|`Stack<a>`|A new stack containing the elements from the input|
|
|
227
|
+
|
|
228
|
+
## Stack.Immutable
|
|
229
|
+
|
|
230
|
+
An immutable stack implementation.
|
|
231
|
+
|
|
232
|
+
### Types
|
|
233
|
+
|
|
234
|
+
Type declarations included in the Stack.Immutable module.
|
|
235
|
+
|
|
236
|
+
#### Stack.Immutable.**ImmutableStack**
|
|
237
|
+
|
|
238
|
+
```grain
|
|
239
|
+
type ImmutableStack<a>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
ImmutableStacks are immutable data structures that store their data in a List.
|
|
243
|
+
|
|
244
|
+
### Values
|
|
245
|
+
|
|
246
|
+
Functions and constants included in the Stack.Immutable module.
|
|
247
|
+
|
|
248
|
+
#### Stack.Immutable.**empty**
|
|
249
|
+
|
|
250
|
+
<details>
|
|
251
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
252
|
+
<table>
|
|
253
|
+
<thead>
|
|
254
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
255
|
+
</thead>
|
|
256
|
+
<tbody>
|
|
257
|
+
<tr><td><code>0.5.4</code></td><td>Originally a module root API</td></tr>
|
|
258
|
+
</tbody>
|
|
259
|
+
</table>
|
|
260
|
+
</details>
|
|
261
|
+
|
|
262
|
+
```grain
|
|
263
|
+
empty : ImmutableStack<a>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
An empty stack.
|
|
267
|
+
|
|
268
|
+
#### Stack.Immutable.**isEmpty**
|
|
269
|
+
|
|
270
|
+
<details>
|
|
271
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
272
|
+
<table>
|
|
273
|
+
<thead>
|
|
274
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
275
|
+
</thead>
|
|
276
|
+
<tbody>
|
|
277
|
+
<tr><td><code>0.3.0</code></td><td>Originally a module root API</td></tr>
|
|
278
|
+
</tbody>
|
|
279
|
+
</table>
|
|
280
|
+
</details>
|
|
281
|
+
|
|
282
|
+
```grain
|
|
283
|
+
isEmpty : (stack: ImmutableStack<a>) => Bool
|
|
77
284
|
```
|
|
78
285
|
|
|
79
286
|
Checks if the given stack contains no items.
|
|
@@ -82,7 +289,7 @@ Parameters:
|
|
|
82
289
|
|
|
83
290
|
|param|type|description|
|
|
84
291
|
|-----|----|-----------|
|
|
85
|
-
|`stack`|`
|
|
292
|
+
|`stack`|`ImmutableStack<a>`|The stack to check|
|
|
86
293
|
|
|
87
294
|
Returns:
|
|
88
295
|
|
|
@@ -90,22 +297,23 @@ Returns:
|
|
|
90
297
|
|----|-----------|
|
|
91
298
|
|`Bool`|`true` if the stack has no items or `false` otherwise|
|
|
92
299
|
|
|
93
|
-
|
|
300
|
+
#### Stack.Immutable.**peek**
|
|
94
301
|
|
|
95
302
|
<details>
|
|
96
|
-
<summary>Added in <code>0.
|
|
303
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
97
304
|
<table>
|
|
98
305
|
<thead>
|
|
99
306
|
<tr><th>version</th><th>changes</th></tr>
|
|
100
307
|
</thead>
|
|
101
308
|
<tbody>
|
|
309
|
+
<tr><td><code>0.3.0</code></td><td>Originally a module root API</td></tr>
|
|
102
310
|
<tr><td><code>0.3.1</code></td><td>Rename from `head` to `peek`</td></tr>
|
|
103
311
|
</tbody>
|
|
104
312
|
</table>
|
|
105
313
|
</details>
|
|
106
314
|
|
|
107
315
|
```grain
|
|
108
|
-
peek :
|
|
316
|
+
peek : (stack: ImmutableStack<a>) => Option<a>
|
|
109
317
|
```
|
|
110
318
|
|
|
111
319
|
Provides the value at the top of the stack, if it exists.
|
|
@@ -114,7 +322,7 @@ Parameters:
|
|
|
114
322
|
|
|
115
323
|
|param|type|description|
|
|
116
324
|
|-----|----|-----------|
|
|
117
|
-
|`stack`|`
|
|
325
|
+
|`stack`|`ImmutableStack<a>`|The stack to inspect|
|
|
118
326
|
|
|
119
327
|
Returns:
|
|
120
328
|
|
|
@@ -122,15 +330,22 @@ Returns:
|
|
|
122
330
|
|----|-----------|
|
|
123
331
|
|`Option<a>`|`Some(value)` containing the value at the top of the stack or `None` otherwise.|
|
|
124
332
|
|
|
125
|
-
|
|
333
|
+
#### Stack.Immutable.**push**
|
|
126
334
|
|
|
127
|
-
<details
|
|
128
|
-
<summary
|
|
129
|
-
|
|
335
|
+
<details>
|
|
336
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
337
|
+
<table>
|
|
338
|
+
<thead>
|
|
339
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
340
|
+
</thead>
|
|
341
|
+
<tbody>
|
|
342
|
+
<tr><td><code>0.3.0</code></td><td>Originally a module root API</td></tr>
|
|
343
|
+
</tbody>
|
|
344
|
+
</table>
|
|
130
345
|
</details>
|
|
131
346
|
|
|
132
347
|
```grain
|
|
133
|
-
push : (a,
|
|
348
|
+
push : (value: a, stack: ImmutableStack<a>) => ImmutableStack<a>
|
|
134
349
|
```
|
|
135
350
|
|
|
136
351
|
Adds a new item to the top of the stack.
|
|
@@ -140,23 +355,30 @@ Parameters:
|
|
|
140
355
|
|param|type|description|
|
|
141
356
|
|-----|----|-----------|
|
|
142
357
|
|`value`|`a`|The item to be added|
|
|
143
|
-
|`stack`|`
|
|
358
|
+
|`stack`|`ImmutableStack<a>`|The stack being updated|
|
|
144
359
|
|
|
145
360
|
Returns:
|
|
146
361
|
|
|
147
362
|
|type|description|
|
|
148
363
|
|----|-----------|
|
|
149
|
-
|`
|
|
364
|
+
|`ImmutableStack<a>`|A new stack with the item added to the end|
|
|
150
365
|
|
|
151
|
-
|
|
366
|
+
#### Stack.Immutable.**pop**
|
|
152
367
|
|
|
153
|
-
<details
|
|
154
|
-
<summary
|
|
155
|
-
|
|
368
|
+
<details>
|
|
369
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
370
|
+
<table>
|
|
371
|
+
<thead>
|
|
372
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
373
|
+
</thead>
|
|
374
|
+
<tbody>
|
|
375
|
+
<tr><td><code>0.3.0</code></td><td>Originally a module root API</td></tr>
|
|
376
|
+
</tbody>
|
|
377
|
+
</table>
|
|
156
378
|
</details>
|
|
157
379
|
|
|
158
380
|
```grain
|
|
159
|
-
pop :
|
|
381
|
+
pop : (stack: ImmutableStack<a>) => ImmutableStack<a>
|
|
160
382
|
```
|
|
161
383
|
|
|
162
384
|
Removes the item at the top of the stack.
|
|
@@ -165,23 +387,30 @@ Parameters:
|
|
|
165
387
|
|
|
166
388
|
|param|type|description|
|
|
167
389
|
|-----|----|-----------|
|
|
168
|
-
|`stack`|`
|
|
390
|
+
|`stack`|`ImmutableStack<a>`|The stack being updated|
|
|
169
391
|
|
|
170
392
|
Returns:
|
|
171
393
|
|
|
172
394
|
|type|description|
|
|
173
395
|
|----|-----------|
|
|
174
|
-
|`
|
|
396
|
+
|`ImmutableStack<a>`|A new stack with the last item removed|
|
|
175
397
|
|
|
176
|
-
|
|
398
|
+
#### Stack.Immutable.**size**
|
|
177
399
|
|
|
178
|
-
<details
|
|
179
|
-
<summary
|
|
180
|
-
|
|
400
|
+
<details>
|
|
401
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
402
|
+
<table>
|
|
403
|
+
<thead>
|
|
404
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
405
|
+
</thead>
|
|
406
|
+
<tbody>
|
|
407
|
+
<tr><td><code>0.3.2</code></td><td>Originally a module root API</td></tr>
|
|
408
|
+
</tbody>
|
|
409
|
+
</table>
|
|
181
410
|
</details>
|
|
182
411
|
|
|
183
412
|
```grain
|
|
184
|
-
size :
|
|
413
|
+
size : (stack: ImmutableStack<a>) => Number
|
|
185
414
|
```
|
|
186
415
|
|
|
187
416
|
Computes the size of the input stack.
|
|
@@ -190,7 +419,7 @@ Parameters:
|
|
|
190
419
|
|
|
191
420
|
|param|type|description|
|
|
192
421
|
|-----|----|-----------|
|
|
193
|
-
|`stack`|`
|
|
422
|
+
|`stack`|`ImmutableStack<a>`|The stack to inspect|
|
|
194
423
|
|
|
195
424
|
Returns:
|
|
196
425
|
|