rgp (version 0.4-1)

st: Type constructors for types in the Rsymbolic type system

Description

These functions create types for the Rsymbolic type system, called sTypes from here on. These functions are used mostly in literal expressions denoting sTypes. st creates a base sType from a string. A base sType is a type without any further structure. Example include st("numeric"), st("character") or st("logical"). %->% creates a function sType, i.e. the type of function, from a vector of argument sTypes and a result sType. A function sType has domain and range containing its argument and result types. Every sType has a string field containing a unambiguous string representation that can serve as a hash table key. STypes can be checked for equality via identical. sObject is the root of the sType hierarchy, i.e. the most general type.

Usage

st(baseTypeName)
domainTypes %->% rangeType
sObject

Arguments

baseTypeName
The name of the base sType to create.
domainTypes
The domain sType of a function sType.
rangeType
The range sType of a function sType.

Value

The created sType.

Format

List of 2
 $ base  : chr "sObject"
 $ string: chr "sObject"
 - attr(*, "class")= chr [1:3] "sBaseType" "sType" "character"

See Also

sTypeInference

Examples

Run this code
st("numeric")
list(st("numeric"), st("numeric")) \%->\% st("logical")
is.sType(st("logical"))

Run the code above in your browser using DataLab