(self: MutableList<A>)
| 225 | * @since 0.0.1 |
| 226 | */ |
| 227 | export const shift = <A>(self: MutableList<A>): A | undefined => { |
| 228 | const head = self.head |
| 229 | if (head !== undefined) { |
| 230 | remove(self, head) |
| 231 | return head.value |
| 232 | } |
| 233 | return undefined |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Removes the last value from the list and returns it, if it exists. |