hook: Hook for custom symbols

View source: R/mathml.R

hookR Documentation

Hook for custom symbols

Description

hook(term, display) hook_fn(fn) unhook(term) hooked(term)

Usage

hook(term, display = NULL, quote = TRUE, as.rolog = TRUE)

unhook(term, quote = TRUE, as.rolog = TRUE)

hooked(term)

hook_fn(fn)

Arguments

term

an R call or symbol/number. This is the expression to replace.

display

an R call or symbol/number. This is shown instead of term.

quote

(default is TRUE) indicates that term and display should be quoted.

as.rolog

(default is TRUE) indicates that simplified quasi-quotation is to be used.

fn

a custom function. The name of fn is replaced by its function body.

Value

hook and unhook return TRUE on success. hooked returns the hooked expression or FALSE on failure.

Examples

hook(t0, subscript(t, 0))
hooked(quote(t0))
mathml(quote(t0))
hook(term=quote(t0), display=quote(superscript(t, 0)), quote=FALSE)
mathml(quote(t0))
unhook(t0)
mathml(quote(t0))
square <- function(x) {x^2} ; hook_fn(square)


mathml documentation built on May 22, 2026, 5:06 p.m.