pop_front: Pop the Front Element

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

pop_frontR Documentation

Pop the Front Element

Description

Returns the first element and the remaining sequence.

Usage

pop_front(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 first element, or NULL when x is empty.

  • remaining: the sequence after removing the first element.

Examples

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

pop_front(flexseq())

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