Skip to contents

Constant-folds subtrees that contain no free variables; otherwise recurses into the children. Preserves every eml call that has at least one free variable in either subtree, so the simplified form is still drawn from the EML grammar (literals, names, and eml nodes only). Idempotent on every catalog entry.

Usage

simplify_eml(expr)

Arguments

expr

an EML expression.

Value

An EML expression (literal or call).

See also

simplify_native() for the mode that collapses to base-R primitives (use this for inspection/verification; use simplify_eml for SR training where the EML grammar must be preserved for completeness).

Examples

simplify_eml(quote(eml(1, 1))) # numeric e (folded)
#> [1] 2.718282+0i
simplify_eml(quote(eml(x, 1))) # unchanged
#> eml(x, 1)
simplify_eml(quote(eml(x, eml(1, 1)))) # eml(x, e)
#> eml(x, 2.71828182845905+0i)