ASTVariable: A Variable in an Abstract Syntax Tree (AST)

Description Usage Format Fields Methods Examples

Description

This node represents a variable of interest in the AST. A variable's name is recorded in the value field, and must conform to the rules of identifiers in R. This class inherits from ASTNode.

Usage

1

Format

R6Class object.

Fields

value

A string containing the variable identifier

format

A format string that is either a string containing a number representing significant digits for output, or a C-style printf string.

type

A string that represents the type specifier for that variable

Methods

new(identifier, format=NA, type=NA)

This method creates an AST node representing a variable of a given identifier. An optional format consisting of a string of a number or a c-style printf string. An option type denoting a forced type cast of that variable.

terms()

Returns the node

distribute()

Applies the distributive property to the node, and returns the resulting node.

string()

Returns the string formula of the node

name()

Return a human representation of a node

reduce(data)

Given a set of data, perform the logical reduction of the current node.

Examples

1
ASTVariable$new("x", "2", "Continuous")$string()

tangram documentation built on June 5, 2018, 1:04 a.m.