% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/30-api-flexseq-get-measure.R
\name{get_measures}
\alias{get_measures}
\title{Read Per-Element Monoid Measures}
\usage{
get_measures(x, monoid_name)
}
\arguments{
\item{x}{A flexseq (or any immutables subclass).}

\item{monoid_name}{Name of an attached monoid.}
}
\value{
A plain unnamed \code{flexseq} of length \code{length(x)}. Entry \code{i} is
the monoid's \code{measure()} applied to the \code{i}-th leaf entry.
}
\description{
Applies the named monoid's \code{measure()} function to each leaf entry in
sequence order, returning the results as a new \code{flexseq}.
}
\details{
Each leaf in a finger tree stores a structure-specific \emph{entry}
(flexseq: the raw element; ordered_sequence: \code{list(value, key)};
priority_queue: \code{list(value, priority)}; interval_index:
\code{list(value, start, end)}). A monoid's \code{measure()} function is defined
over that entry shape, and this accessor exposes the per-element
values that would be combined to produce the cached aggregate.

Returns a \code{flexseq} rather than a base list so results can be piped
back into other immutables operations; use \code{\link[=as.list]{as.list()}} or \code{\link[=unlist]{unlist()}}
to convert.
}
\examples{
sum_m <- measure_monoid(`+`, 0, function(el) el)
x <- add_monoids(as_flexseq(c(3, 1, 4, 1, 5, 9)), list(sum = sum_m))
get_measures(x, "sum") |> unlist()

q <- priority_queue("a", "b", "c", priorities = c(5, 1, 3))
# Per-element .pq_min measures — each is list(has, priority).
get_measures(q, ".pq_min")
}
\seealso{
\code{\link[=get_measure]{get_measure()}}, \code{\link[=measure_monoid]{measure_monoid()}}, \code{\link[=fapply]{fapply()}}
}
