% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ergonomics.R
\name{shard_lapply_shared}
\alias{shard_lapply_shared}
\title{Apply a Function Over a List with Optional Auto-Sharing}
\usage{
shard_lapply_shared(
  x,
  FUN,
  VARS = NULL,
  workers = NULL,
  ...,
  policy = shard_apply_policy()
)
}
\arguments{
\item{x}{A list.}

\item{FUN}{Function of the form \verb{function(el, ...)}.}

\item{VARS}{Optional named list of extra variables (auto-shared when large).}

\item{workers}{Number of workers (passed to \code{\link[=shard_map]{shard_map()}}).}

\item{...}{Additional arguments forwarded to \code{FUN}.}

\item{policy}{A \code{\link[=shard_apply_policy]{shard_apply_policy()}} object.}
}
\value{
A list of results, one per element of \code{x}.
}
\description{
A convenience wrapper for list workloads that need supervision and shared
inputs. Large atomic list elements are auto-shared based on policy.
}
\details{
This wrapper enforces guardrails to avoid accidental huge gathers: it
estimates the total gathered result size from a probe call and refuses
to run if it exceeds \code{policy$max_gather_bytes}.
}
\examples{
\donttest{
res <- shard_lapply_shared(as.list(1:4), function(x) x^2)
pool_stop()
res
}
}
