export class Stack { #list: T[] constructor(list: Iterable) { this.#list = Array.from(list) } get size() { return this.#list.length } get top() { return this.#list[0] ?? null } pop() { if (this.#list.length === 0) { return null } return this.#list.shift() ?? null } }