pop_all_key: Pop All Elements for One Key

View source: R/50-ordered_sequence-ops.R

pop_all_keyR Documentation

Pop All Elements for One Key

Description

Removes and returns all elements whose key equals key.

Usage

pop_all_key(x, key)

Arguments

x

An ordered_sequence.

key

Query key.

Details

Use as.list() to convert elements to a standard R list.

Value

A list with fields:

  • elements: ordered_sequence of removed matches.

  • remaining: ordered_sequence after removal.

Examples

x <- ordered_sequence("a", "b", "c", keys = c(1, 2, 2))
out <- pop_all_key(x, 2)
as.list(out$elements)
out$remaining

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