m2_parser: Convert a M2 object into an R object

m2_parserR Documentation

Convert a M2 object into an R object

Description

Convert a M2 object into an R object

Usage

m2_parse(s)

## Default S3 method:
m2_parse_class(x)

## S3 method for class 'm2_hashtable'
m2_parse_class(x)

## S3 method for class 'm2_optiontable'
m2_parse_class(x)

## S3 method for class 'm2_verticallist'
m2_parse_class(x)

## Default S3 method:
m2_parse_function(x)

## S3 method for class 'm2_hashtable'
m2_parse_function(x)

## S3 method for class 'm2_optiontable'
m2_parse_function(x)

## S3 method for class 'm2_verticallist'
m2_parse_function(x)

## S3 method for class 'm2_symbol'
m2_parse_function(x)

## S3 method for class 'm2_monoid'
m2_parse_function(x)

## S3 method for class 'm2_tocc'
m2_parse_function(x)

## Default S3 method:
m2_parse_object_as_function(x, params)

## S3 method for class 'm2_symbol'
m2_parse_object_as_function(x, params)

## S3 method for class 'm2_integer'
print(x, ...)

## S3 method for class 'm2_float'
print(x, ...)

## S3 method for class 'm2_complex'
print(x, ...)

## S3 method for class 'm2_string'
print(x, ...)

## S3 method for class 'm2_boolean'
print(x, ...)

## S3 method for class 'm2_list'
print(x, ...)

## S3 method for class 'm2_array'
print(x, ...)

## S3 method for class 'm2_sequence'
print(x, ...)

## S3 method for class 'm2_symbol'
print(x, ...)

## S3 method for class 'm2_option'
print(x, ...)

## S3 method for class 'm2_hashtable'
print(x, ...)

## S3 method for class 'm2_module'
print(x, ...)

m2_toggle_gmp()

get_m2_gmp()

Arguments

s

a character(1), typically the result of running toExternalString on an M2 object

x

an object to be printed

params

e.g. ⁠[x,y,z]⁠ or ⁠[x..z]⁠

...

...

Value

an R object

References

D. Kahle, C. O'Neill, and J. Sommars (2020). "A Computer Algebra System for R: Macaulay2 and the m2r Package." Journal of Statistical Software, 93(9):1-31.

Examples


## Not run:  requires Macaulay2

m2("1+1")
m2.("1+1")
m2_parse(m2.("1+1"))

m2("QQ[x,y]")
m2.("QQ[x,y]")
m2_parse(m2.("QQ[x,y]"))

get_m2_gmp()
m2("3/2") %>% m2_parse()
m2_toggle_gmp() # gmp on
m2("3/2") %>% m2_parse()
m2("6/4") %>% m2_parse()
m2("3345234524352435432/223454325235432524352433245") %>% m2_parse()
m2_toggle_gmp() # gmp off



m2("50!") %>% m2_parse()
m2_toggle_gmp() # gmp on
m2("50!") %>% m2_parse()
m2_toggle_gmp() # gmp off


## End(Not run)

m2r documentation built on June 10, 2025, 9:08 a.m.