pop_back: Pop the Back Element

View source: R/30-api-flexseq-ends.R

pop_backR Documentation

Pop the Back Element

Description

Returns the last element and the remaining sequence.

Usage

pop_back(x)

Arguments

x

A flexseq.

Details

This operation is persistent: x is not modified.

On empty input, returns a non-throwing miss object with value = NULL and remaining = x.

Value

A list with fields:

  • value: the last element, or NULL when x is empty.

  • remaining: the sequence after removing the last element.

Examples

s <- flexseq("a", "b", "c")
out <- pop_back(s)
out$value
out$remaining
s  # unchanged

pop_back(flexseq())

Immutables documentation built on April 29, 2026, 1:06 a.m.