Skip to main content

interp_vapply

Function interp_vapply 

Source
fn interp_vapply(
    positional: &[RValue],
    named: &[(String, RValue)],
    context: &BuiltinContext<'_>,
) -> Result<RValue, RError>
Expand description

Apply a function over a vector or list with a type-checked return template.

vapply is similar to sapply, but requires a FUN.VALUE template that specifies the expected return type and length. Each result is checked against the template, and an error is raised if there is a mismatch.

@param X vector or list to iterate over @param FUN function to apply to each element @param FUN.VALUE template value specifying the expected return type and length @param … additional arguments passed to FUN @return simplified vector matching FUN.VALUE type