Hi, a quick comment.  I just notice that as.list() deals with
function:s the old way inside the "default" function, cf.

> as.list.default
function (x, ...)
{
    if (typeof(x) == "list")
        return(x)
    if (is.function(x))
        return(c(formals(x), list(body(x))))
    .Internal(as.vector(x, "list"))
}
<environment: namespace:base>

The following should do the same thing cleaner (and faster?):

as.list.function <- function(x, ...)
{
    c(formals(x), list(body(x)))
}

as.list.default <- function (x, ...)
{
    if (typeof(x) == "list")
        return(x)
    .Internal(as.vector(x, "list"))
}

/Henrik

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to