Operation-class: Operation: A Simple Command Implementation
Description
An Operation object implements a Command with an R
closure. This may be useful as a base for customized Command
derivatives. Otherwise, consider it a skeletal proof-of-concept.
Arguments
Constructors
Operation(do, undo = NULL): Constructs
an Operation that invokes the closure do. If
undo is specified, it is the closure invoked for the
reverse operation.
OperationQ(do, undo): Constructs
an Operation that invokes a function with the body taken from
the quoted argument do. The function is enclosed in the
calling environment. If undo is specified, it is
treated equivalently to do, except it should implement the
reverse operation.
Methods
eval(expr): Executes the operation by evaluating the
closure.
rev(x): Returns a new Operation that performs
the reverse operation, as long as undo was provided.