Skip to main content

Module builtins

Module builtins 

Source

Re-exportsΒ§

pub use crate::interpreter::value::BuiltinDescriptor;
pub use crate::interpreter::value::BuiltinFn;
pub use crate::interpreter::value::BuiltinImplementation;
pub use crate::interpreter::value::InterpreterBuiltinFn;
pub use crate::interpreter::value::PreEvalBuiltinFn;

ModulesΒ§

args πŸ”’
Shared decoding helpers for builtin positional and named arguments.
coercion πŸ”’
Coercion builtins: as.integer, as.double, as.character, etc.
collections
Rust std::collections exposed as R data structures.
conditions πŸ”’
R condition system builtins β€” stop, warning, message, signalCondition, condition constructors, condition accessors, and restart invocation.
connections
Connection object builtins β€” file connections, stdin/stdout/stderr, TCP sockets.
dataframes πŸ”’
Data frame manipulation builtins β€” merge, subset, transform, with.
datetime πŸ”’
Date and time builtins: Sys.Date, as.Date, as.POSIXct, format.Date, etc.
digest πŸ”’
Cryptographic digest builtins (SHA-256, SHA-512, BLAKE3, CRC32).
factors πŸ”’
Factor builtins β€” factor construction, levels, and nlevels.
graphics
Graphics builtins β€” high-level R plotting functions that accumulate PlotItems in the interpreter’s PlotState, then display via egui_plot (when the plot feature is enabled) or print a helpful message (when it is not).
grid
Grid graphics builtins β€” R-facing functions for the grid graphics system.
interp πŸ”’
Interpreter-level builtins β€” functions that receive BuiltinContext so they can call back into the active interpreter without direct TLS lookups. Each is auto-registered via #[interpreter_builtin].
io
File I/O builtins β€” reading and writing data files (CSV, table, lines, scan) and file system utilities (file.path, file.exists).
json πŸ”’
JSON builtins β€” fromJSON() and toJSON() providing jsonlite-compatible conversion between R values and JSON strings.
math
native_code πŸ”’
Native code builtins β€” .Call(), dyn.load(), dyn.unload(), etc.
net πŸ”’
HTTP/HTTPS networking builtins β€” download.file() and url().
parquet πŸ”’
Parquet I/O builtins β€” read.parquet() and write.parquet() for reading and writing Apache Parquet files as data frames.
pre_eval πŸ”’
Pre-eval builtins β€” functions that intercept before argument evaluation. Each is auto-registered via #[pre_eval_builtin]. The interpreter is accessed via the BuiltinContext passed at dispatch time.
progress
Text progress bar builtins backed by the indicatif crate.
random πŸ”’
Random number generation builtins: set.seed, runif, rnorm, rbinom, sample, etc. Uses the per-interpreter RNG state via BuiltinContext.
rlang_ffi
s4 πŸ”’
S4 OOP system β€” class registry, method dispatch, and object construction.
serialize
GNU R serialization β€” reading and writing RDS files.
stats πŸ”’
Statistics builtins: cor, cov, weighted.mean, scale, complete.cases, na.omit, and distribution functions (d/p/q for norm, unif, exp, gamma, beta, cauchy, weibull, lnorm, chisq, t, f, binom, pois, geom, hyper).
strings
stubs πŸ”’
Stub builtins β€” not-yet-implemented functions that return sensible defaults or fail explicitly. Also includes lightweight implementations of commonly needed functions that don’t warrant their own module.
system
System, file, directory, path, and temp builtins.
tables πŸ”’
Table and tabulate builtins β€” contingency tables and integer bin counting.
tables_display πŸ”’
Rich table display builtins using the tabled crate.
toml πŸ”’
TOML builtins β€” read.toml(), write.toml(), toml_parse(), and toml_serialize() for reading, writing, and converting between R values and TOML.
types πŸ”’
Type-checking builtins: is.null, is.na, is.numeric, etc.

StructsΒ§

BindInput πŸ”’

StaticsΒ§

BUILTIN_REGISTRY
__BUILTIN_REG_BUILTIN_ALL πŸ”’
__BUILTIN_REG_BUILTIN_ALL_EQUAL πŸ”’
__BUILTIN_REG_BUILTIN_ANY πŸ”’
__BUILTIN_REG_BUILTIN_ANY_DUPLICATED πŸ”’
__BUILTIN_REG_BUILTIN_APERM πŸ”’
__BUILTIN_REG_BUILTIN_ARGS πŸ”’
__BUILTIN_REG_BUILTIN_ARRAY πŸ”’
__BUILTIN_REG_BUILTIN_ASIS πŸ”’
__BUILTIN_REG_BUILTIN_AS_FUNCTION πŸ”’
__BUILTIN_REG_BUILTIN_AS_FUNCTION_DEFAULT πŸ”’
__BUILTIN_REG_BUILTIN_ATTR πŸ”’
__BUILTIN_REG_BUILTIN_ATTRIBUTES πŸ”’
__BUILTIN_REG_BUILTIN_ATTR_SET πŸ”’
__BUILTIN_REG_BUILTIN_BODY πŸ”’
__BUILTIN_REG_BUILTIN_BODY_SET πŸ”’
__BUILTIN_REG_BUILTIN_C πŸ”’
__BUILTIN_REG_BUILTIN_CALL πŸ”’
__BUILTIN_REG_BUILTIN_CBIND πŸ”’
__BUILTIN_REG_BUILTIN_CHARACTER πŸ”’
__BUILTIN_REG_BUILTIN_CHARMATCH πŸ”’
__BUILTIN_REG_BUILTIN_CLASS πŸ”’
__BUILTIN_REG_BUILTIN_CLASS_SET πŸ”’
__BUILTIN_REG_BUILTIN_COL_NAMES πŸ”’
__BUILTIN_REG_BUILTIN_COL_NAMES_SET πŸ”’
__BUILTIN_REG_BUILTIN_CUT πŸ”’
__BUILTIN_REG_BUILTIN_DIM πŸ”’
__BUILTIN_REG_BUILTIN_DIMNAMES πŸ”’
__BUILTIN_REG_BUILTIN_DIMNAMES_SET πŸ”’
__BUILTIN_REG_BUILTIN_DIM_SET πŸ”’
__BUILTIN_REG_BUILTIN_DUPLICATED πŸ”’
__BUILTIN_REG_BUILTIN_ENVIRONMENT_NAME πŸ”’
__BUILTIN_REG_BUILTIN_ENVIRONMENT_SET πŸ”’
__BUILTIN_REG_BUILTIN_EXPAND_GRID πŸ”’
__BUILTIN_REG_BUILTIN_FIND_INTERVAL πŸ”’
__BUILTIN_REG_BUILTIN_FORCE πŸ”’
__BUILTIN_REG_BUILTIN_FORMALS πŸ”’
__BUILTIN_REG_BUILTIN_FORMALS_SET πŸ”’
__BUILTIN_REG_BUILTIN_GC πŸ”’
__BUILTIN_REG_BUILTIN_GCINFO πŸ”’
__BUILTIN_REG_BUILTIN_IDENTICAL πŸ”’
__BUILTIN_REG_BUILTIN_IDENTITY πŸ”’
__BUILTIN_REG_BUILTIN_IFELSE πŸ”’
__BUILTIN_REG_BUILTIN_INHERITS πŸ”’
__BUILTIN_REG_BUILTIN_INTEGER πŸ”’
__BUILTIN_REG_BUILTIN_INTERSECT πŸ”’
__BUILTIN_REG_BUILTIN_ISDEBUGGED πŸ”’
__BUILTIN_REG_BUILTIN_LENGTH πŸ”’
__BUILTIN_REG_BUILTIN_LIST πŸ”’
__BUILTIN_REG_BUILTIN_LOGICAL πŸ”’
__BUILTIN_REG_BUILTIN_MATCH πŸ”’
__BUILTIN_REG_BUILTIN_MATCH_ARG πŸ”’
__BUILTIN_REG_BUILTIN_MATRIX πŸ”’
__BUILTIN_REG_BUILTIN_MODE πŸ”’
__BUILTIN_REG_BUILTIN_MODIFY_LIST πŸ”’
__BUILTIN_REG_BUILTIN_NAMES πŸ”’
__BUILTIN_REG_BUILTIN_NAMES_SET πŸ”’
__BUILTIN_REG_BUILTIN_NCHAR πŸ”’
__BUILTIN_REG_BUILTIN_NCOL πŸ”’
__BUILTIN_REG_BUILTIN_NCOL_SAFE πŸ”’
__BUILTIN_REG_BUILTIN_NEW_ENV πŸ”’
__BUILTIN_REG_BUILTIN_NROW πŸ”’
__BUILTIN_REG_BUILTIN_NROW_SAFE πŸ”’
__BUILTIN_REG_BUILTIN_NUMERIC πŸ”’
__BUILTIN_REG_BUILTIN_OLD_CLASS πŸ”’
__BUILTIN_REG_BUILTIN_OLD_CLASS_SET πŸ”’
__BUILTIN_REG_BUILTIN_PAIRLIST πŸ”’
__BUILTIN_REG_BUILTIN_PARENT_ENV πŸ”’
__BUILTIN_REG_BUILTIN_PARENT_ENV_SET πŸ”’
__BUILTIN_REG_BUILTIN_PASTE πŸ”’
__BUILTIN_REG_BUILTIN_PASTE0 πŸ”’
__BUILTIN_REG_BUILTIN_PMATCH πŸ”’
__BUILTIN_REG_BUILTIN_Q πŸ”’
__BUILTIN_REG_BUILTIN_RBIND πŸ”’
__BUILTIN_REG_BUILTIN_REPLACE πŸ”’
__BUILTIN_REG_BUILTIN_ROW_NAMES πŸ”’
__BUILTIN_REG_BUILTIN_ROW_NAMES_SET πŸ”’
__BUILTIN_REG_BUILTIN_R_VERSION πŸ”’
__BUILTIN_REG_BUILTIN_SETDIFF πŸ”’
__BUILTIN_REG_BUILTIN_STOPIFNOT πŸ”’
__BUILTIN_REG_BUILTIN_STRUCTURE πŸ”’
__BUILTIN_REG_BUILTIN_SYS_LOCALECONV πŸ”’
__BUILTIN_REG_BUILTIN_TYPEOF πŸ”’
__BUILTIN_REG_BUILTIN_UNCLASS πŸ”’
__BUILTIN_REG_BUILTIN_UNDEBUG πŸ”’
__BUILTIN_REG_BUILTIN_UNION πŸ”’
__BUILTIN_REG_BUILTIN_UNLIST πŸ”’
__BUILTIN_REG_BUILTIN_UNNAME πŸ”’
__BUILTIN_REG_BUILTIN_USE_METHOD πŸ”’
__BUILTIN_REG_BUILTIN_VECTOR πŸ”’
__BUILTIN_REG_BUILTIN_XOR πŸ”’
__INTERP_REG_BUILTIN_CAT πŸ”’
__INTERP_REG_INTERP_BROWSER πŸ”’
__INTERP_REG_INTERP_DEBUG πŸ”’
__INTERP_REG_INTERP_DETACH πŸ”’
__INTERP_REG_INTERP_GETWD πŸ”’
__INTERP_REG_INTERP_HELP πŸ”’
__INTERP_REG_INTERP_LOAD_NAMESPACE πŸ”’
__INTERP_REG_INTERP_READLINE πŸ”’
__INTERP_REG_INTERP_REQUIRE_NAMESPACE πŸ”’
__INTERP_REG_INTERP_STR πŸ”’
__INTERP_REG_INTERP_SYS_GETENV πŸ”’
__INTERP_REG_INTERP_TRACEBACK πŸ”’

FunctionsΒ§

all_equal_attrs πŸ”’
Compare attributes of two objects.
all_equal_character πŸ”’
Compare character vectors element-wise.
all_equal_lists πŸ”’
Compare two lists recursively.
all_equal_names_attr πŸ”’
Check only the β€œnames” attribute.
all_equal_numeric πŸ”’
Compare numeric vectors using R’s mean relative/absolute difference.
all_equal_recurse πŸ”’
Recursively compare two R values, collecting difference messages.
all_equal_vectors πŸ”’
Compare two vectors, collecting difference messages.
as_function_impl πŸ”’
attrs_identical πŸ”’
Compare two attribute maps for identical-ness.
automatic_row_names_value πŸ”’
bind_dimnames_value πŸ”’
builtin_all πŸ”’
Test if all values are TRUE.
builtin_all_equal πŸ”’
Test near-equality of two objects within a tolerance.
builtin_any πŸ”’
Test if any values are TRUE.
builtin_any_duplicated πŸ”’
anyDuplicated(x) β€” index of first duplicate, or 0 if none.
builtin_aperm πŸ”’
Transpose or permute the dimensions of an array.
builtin_args πŸ”’
args(fn) β€” return the formals of a function (simplified: same as formals). In GNU R, args() returns a function with the same formals but NULL body. We simplify to just returning formals, which covers all practical uses.
builtin_array πŸ”’
Create a multi-dimensional array.
builtin_as_function πŸ”’
as.function(x, envir) β€” convert a list to a function.
builtin_as_function_default πŸ”’
as.function.default β€” same as as.function, dispatched for default method.
builtin_asis πŸ”’
I(x) β€” mark an object as β€œAsIs”, inhibiting conversion.
builtin_attr πŸ”’
Get a single attribute of an object.
builtin_attr_set πŸ”’
Set a single attribute on an object.
builtin_attributes πŸ”’
Get all attributes of an object as a named list.
builtin_body πŸ”’
body(fn) β€” return the body of a function as a Language object. For closures, returns the body expression. For builtins, returns NULL.
builtin_body_set πŸ”’
body<-(fn, value) β€” set the body of a closure.
builtin_c
Combine values into a vector or list.
builtin_call πŸ”’
call(name, ...) β€” construct an unevaluated function call expression. call("f", 1, 2) returns the language object f(1, 2).
builtin_cat πŸ”’
Concatenate and print objects to stdout.
builtin_cbind πŸ”’
Bind vectors, matrices, or data frames by columns.
builtin_character πŸ”’
Create a character vector of empty strings with the given length.
builtin_charmatch πŸ”’
Character partial matching β€” like pmatch but returns 0 for ambiguous matches.
builtin_class πŸ”’
Get the class of an object.
builtin_class_set πŸ”’
Set the class attribute of an object.
builtin_col_names πŸ”’
Get the column names of a data frame or matrix.
builtin_col_names_set πŸ”’
Set the column names of a data frame or matrix.
builtin_cut πŸ”’
Bin continuous values into intervals, returning a factor with interval labels.
builtin_dim πŸ”’
Get the dimensions of a matrix, array, or data frame.
builtin_dim_set πŸ”’
Set the dimensions of an object, converting it to a matrix or array.
builtin_dimnames πŸ”’
Get the dimension names of a matrix, array, or data frame.
builtin_dimnames_set πŸ”’
Set the dimension names of a matrix, array, or data frame.
builtin_duplicated πŸ”’
Identify duplicate elements in a vector.
builtin_environment_name πŸ”’
Get the name of an environment.
builtin_environment_set πŸ”’
environment<-(fn, value) β€” set the environment of a closure.
builtin_expand_grid πŸ”’
Create a data frame from all combinations of the supplied vectors.
builtin_find_interval πŸ”’
Find the interval index containing each element of x.
builtin_force πŸ”’
Return its argument unchanged. Forces evaluation of a promise. @param x any R value @return x, unchanged
builtin_formals πŸ”’
formals(fn) β€” return the formal parameter list of a function as a named list.
builtin_formals_set πŸ”’
formals<-(fn, value) β€” set the formals of a closure.
builtin_gc πŸ”’
Trigger garbage collection (stub).
builtin_gcinfo πŸ”’
Set or query verbose GC reporting (stub).
builtin_identical πŸ”’
Test if two objects are exactly identical.
builtin_identity πŸ”’
Return its argument unchanged (identity function). @param x any R value @return x, unchanged
builtin_ifelse πŸ”’
Vectorized conditional: for each element of test, select the corresponding element from yes (when TRUE) or no (when FALSE). yes and no are recycled to the length of test.
builtin_inherits πŸ”’
Test if an object inherits from one or more classes.
builtin_integer πŸ”’
Create an integer vector of zeros with the given length.
builtin_intersect πŸ”’
Set intersection: elements present in both x and y.
builtin_isdebugged πŸ”’
Query whether a function has debug-mode enabled (stub).
builtin_length πŸ”’
Get the length of an object.
builtin_list πŸ”’
Construct a list from the given arguments.
builtin_logical πŸ”’
Create a logical vector of FALSE values with the given length.
builtin_match πŸ”’
Find positions of first matches of x in table.
builtin_match_arg πŸ”’
Match an argument to a set of candidate values.
builtin_matrix πŸ”’
Create a matrix from the given data.
builtin_mode πŸ”’
Get the mode (storage type) of an object.
builtin_modify_list πŸ”’
Modify a list by replacing/adding/removing elements from another list.
builtin_names πŸ”’
Get the names attribute of an object.
builtin_names_set πŸ”’
Set the names attribute of an object.
builtin_nchar πŸ”’
Count the number of characters in each element of a character vector.
builtin_ncol πŸ”’
Get the number of columns of a matrix, array, or data frame.
builtin_ncol_safe πŸ”’
Get the number of columns, treating non-matrix vectors as 1-column.
builtin_new_env πŸ”’
Create a new environment.
builtin_nrow πŸ”’
Get the number of rows of a matrix, array, or data frame.
builtin_nrow_safe πŸ”’
Get the number of rows, treating non-matrix vectors as 1-column matrices.
builtin_numeric πŸ”’
Create a double vector of zeros with the given length.
builtin_old_class πŸ”’
Get the class attribute of an object (S3 compat alias for class()). @param x any R value @return class attribute or NULL @namespace base
builtin_old_class_set πŸ”’
Set the old-style (S3) class attribute β€” alias for class<-. @param x object @param value class names or NULL @return modified object @namespace base
builtin_pairlist πŸ”’
Create a pairlist from named arguments.
builtin_parent_env πŸ”’
Get the parent (enclosing) environment of an environment.
builtin_parent_env_set πŸ”’
Set the parent (enclosing) environment.
builtin_paste πŸ”’
Concatenate strings with a separator.
builtin_paste0 πŸ”’
Concatenate strings with no separator.
builtin_pmatch πŸ”’
Partial string matching β€” find unique partial matches of x in table.
builtin_q πŸ”’
Terminate the R session.
builtin_r_version πŸ”’
Get the version of the R implementation.
builtin_rbind πŸ”’
Bind vectors, matrices, or data frames by rows.
builtin_replace πŸ”’
Replace values in a vector at specified indices.
builtin_row_names πŸ”’
Get the row names of a data frame or matrix.
builtin_row_names_set πŸ”’
Set the row names of a data frame or matrix.
builtin_setdiff πŸ”’
Set difference: elements in x that are not in y.
builtin_stopifnot πŸ”’
Assert that all arguments are TRUE, stopping with an error otherwise.
builtin_structure πŸ”’
Set attributes on an object in a single call.
builtin_sys_localeconv πŸ”’
Return locale-specific numeric formatting conventions.
builtin_typeof πŸ”’
Get the internal type of an object.
builtin_unclass πŸ”’
Remove the class attribute from an object.
builtin_undebug πŸ”’
Remove debug-mode single-stepping from a function (stub).
builtin_union πŸ”’
Set union: unique elements from both x and y.
builtin_unlist πŸ”’
Flatten a list into an atomic vector.
builtin_unname πŸ”’
Remove names and dimnames from an object.
builtin_use_method πŸ”’
UseMethod() is intercepted directly by the evaluator so it can unwind the current generic frame instead of returning like an ordinary builtin.
builtin_vector πŸ”’
Create a vector of a given mode and length.
builtin_xor πŸ”’
Vectorized exclusive OR.
cbind_data_frames πŸ”’
Column-bind data frames.
character_name_vector πŸ”’
coerce_name_strings πŸ”’
coerce_name_values πŸ”’
collect_c_names πŸ”’
Collect element names for c(): named arguments provide names for scalars, existing names attributes provide names for vector elements.
collect_list_elements_recursive πŸ”’
Recursively collect all non-list elements from a list and its nested sublists.
combine_expand_grid_column πŸ”’
Combine a column of scalar RValues back into a single typed vector.
concat_column_values πŸ”’
Concatenate column values from multiple data frames into a single column.
data_frame_dimnames_value πŸ”’
data_frame_row_count πŸ”’
dimnames_component πŸ”’
empty_expand_grid πŸ”’
Return an empty data.frame for expand.grid with zero-length inputs.
extract_param_names_from_doc πŸ”’
Extract parameter names from a doc string’s @param name ... lines.
find_builtin
Look up a builtin descriptor by R name or alias.
find_builtin_ns
Look up a builtin by namespace::name (e.g. β€œstats::cor”).
format_help
Format a builtin’s doc string for display. Convention: first line = title, rest = description/params.
format_r_double_cut πŸ”’
Format a double for cut() labels β€” avoid trailing zeros but keep precision.
generate_rd_docs
Generate .Rd documentation files for all documented builtins.
get_dim_ints πŸ”’
Extract integer dim values from a dim attribute
has_class πŸ”’
interp_browser πŸ”’
Enter the browser for interactive debugging (stub).
interp_debug πŸ”’
Set a function for debug-mode single-stepping (stub).
interp_detach πŸ”’
Detach a package from the search path.
interp_getwd πŸ”’
Get the interpreter’s current working directory.
interp_help πŸ”’
Display help for a function.
interp_load_namespace πŸ”’
Load a package namespace without attaching it to the search path.
interp_readline πŸ”’
Read a line of user input from stdin.
interp_require_namespace πŸ”’
Check if a namespace can be loaded, returning TRUE/FALSE.
interp_str πŸ”’
Display the compact internal structure of an object.
interp_sys_getenv πŸ”’
Get environment variable(s) from the interpreter’s environment.
interp_traceback πŸ”’
Print the call stack of the last error.
list_names_value πŸ”’
math_unary_op
Helper for unary math builtins: applies f64 -> f64 element-wise.
r_identical πŸ”’
Deep structural comparison of two R values.
rbind_data_frames πŸ”’
Row-bind data frames by matching column names.
register_builtin_binding πŸ”’
register_builtins
register_operator_builtins πŸ”’
Register R’s primitive operators as first-class callable functions.
rvalue_to_expr πŸ”’
Convert an RValue back to an AST expression (for call/expression construction).
sanitize_rd_filename πŸ”’
Sanitize a builtin name for use as a filename.
set_data_frame_col_names πŸ”’
set_data_frame_dimnames πŸ”’
set_data_frame_row_names πŸ”’
set_key πŸ”’
Canonical string key for set operations β€” works across numeric and character types.
set_list_names πŸ”’
set_op_extract πŸ”’
Determine whether set operations should work in numeric or character mode. Returns the result type based on input types: numeric inputs stay numeric.
set_result_numeric πŸ”’
Reconstruct a numeric vector from character representations produced by set operations.
str_format_element πŸ”’
Format one element for str() output (used for list elements). Returns a one-line summary: β€œ type [1:len] previewβ€œ for vectors, β€œList of N” for nested lists, etc.
str_vector_preview πŸ”’
Format a vector element preview for str() output (first 10 elements).
synthesize_builtin_help
Synthesize RdDoc help pages from all builtin descriptors and register them in the help index. This gives every builtin a rich help page (title, usage, arguments, return value) derived from rustdoc comments.
updated_dimnames_component πŸ”’
vector_to_items πŸ”’
Extract scalar items from an RValue for expand.grid column construction.
vectors_identical πŸ”’
Element-wise comparison of two atomic vectors.