export default function pop(x) {
    if (x === null) throw new Error('input list is empty');
    assert(x instanceof Node);
    return [x.prev === null ? null : _pop(x), x];
}