% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/30-api-flexseq-ends.R
\name{pop_at}
\alias{pop_at}
\title{Pop an Element by Position}
\usage{
pop_at(x, index)
}
\arguments{
\item{x}{A \code{flexseq}.}

\item{index}{One-based position to remove.}
}
\value{
A list with fields:
\itemize{
\item \code{value}: the element at \code{index}, or \code{NULL} when \code{index} is out of bounds.
\item \code{remaining}: the sequence after removing the selected element.
}
}
\description{
Returns the selected element and the remaining sequence.
}
\details{
This operation is persistent: \code{x} is not modified.

Positive integer indices beyond \code{length(x)} return a non-throwing miss object
with \code{value = NULL} and \code{remaining = x}.
Invalid indices (\code{NA}, non-integer, \verb{<= 0}, or length not equal to 1) error.
}
\examples{
x <- flexseq("a", "b", "c", "d")
out <- pop_at(x, 3)
out$value
out$remaining
x  # unchanged

pop_at(x, 10)
try(pop_at(x, 0))
}
