R/symbolic_array.R

Defines functions `[.symArray` print.symArray symArray

#### A simple wrapper around R's list. i.e. a list of Basic object.
#### This is still a work in progress, so do not export it.
####
#### Also check out the "vctrs" package.

symArray <- function(...) {
    ans <- lapply(list(...), S)
    class(ans) <- "symArray"
    ans
}

print.symArray <- function(x, ...) {
    ## TODO: to improve this...
    ## maybe we need to define method for format instead?
    for (i in seq_along(x))
        x[[i]] <- as.character(x[[i]])
    print.default(x, ...)
    x
}

## Preserve class attributes for these functions

`[.symArray` <- function(x,...) {
    ans <- NextMethod("[")
    class(ans) <- class(x)
    ans
}


## So that it can be used in data frame
as.data.frame.symArray <- as.data.frame.vector

Try the symengine package in your browser

Any scripts or data that you put into this service are public.

symengine documentation built on Oct. 23, 2022, 5:06 p.m.