Learn R Programming

lambda.r (version 1.2.4)

introspection: Introspection for lambda.r

Description

These tools are used for debugging and provide a means of examining the evaluation order of the function definitions as well as provide a lambda.r compatible debugger.

Usage

debug.lr(x)

undebug.lr(x)

is.debug(fn.name)

which.debug()

undebug.all()

describe(…) # S3 method for lambdar.fun print(x, …) # S3 method for lambdar.type print(x, …)

Arguments

x

The function

fn.name

The name of the function

Additional arguments

Value

The defined functions are invisibly returned.

Details

For a basic description of the function it is easiest to just type the function name in the shell. This will call the print methods and print a clean output of the function definition. The definition is organized based on each function clause. If a type constraint exists, this precedes the clause signature including guards. To reduce clutter, the actual body of the function clause is not printed. To view a clause body, each clause is prefixed with an index number, which can be used in the describe function to get a full listing of the function.

describe(fn, idx)

The 'debug.lr' and 'undebug.lr' functions are replacements for the built-in debug and undebug functions. They provide a mechanism to debug a complete function, which is compatible with the dispatching in lambda.r. The semantics are identical to the built-ins. Note that these functions will properly handle non-lambda.r functions so only one set of commands need to be issued.

Lambda.r keeps track of all functions that are being debugged. To see if a function is currently set for debugging, use the is.debug function. To see all functions that are being debugged, use which.debug. It is possible to undebug all debugged functions by calling undebug.all.

Examples

Run this code
# NOT RUN {
f(x) <!-- %as% x -->
debug.lr(f)
which.debug()
undebug.lr(f)
# }

Run the code above in your browser using DataLab