~showard314/ubuntu/karmic/r-base/remove_start_comments

« back to all changes in this revision

Viewing changes to src/library/base/R/formals.R

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2008-12-20 09:26:38 UTC
  • mfrom: (1.2.6 upstream)
  • mto: (2.1.32 jaunty)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20081220092638-i4p6po0hndi24ri5
* Updated to Dec 19 release candidate of R 2.8.1 expected for Dec 22

* r-doc-pdf expected to be empty due to the tex/texinfo bug below

* debian/control: Change Build-Depends: on openjdk-6-jdk to 
  'openjdk-6-jdk [!arm !hppa]' as arm and hppa do not have one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
alist <- function (...) as.list(sys.call())[-1]
30
30
 
31
31
`body<-` <- function (fun, envir = environment(fun), value) {
32
 
    if (is.expression(value)) value <- value[[1]]
33
 
    as.function(c(formals(fun), value), envir)
 
32
    if (is.expression(value)) {
 
33
        if (length(value) > 1)
 
34
            warning("using the first element of 'value' of type expression")
 
35
        value <- value[[1]]
 
36
    }
 
37
    as.function(c(as.list(formals(fun)), value), envir)
34
38
}
35
39
 
36
40
`formals<-` <- function (fun, envir = environment(fun), value)
37
41
{
38
42
    bd <- body(fun)
39
 
    as.function(c(value, if(is.null(bd)) list(bd) else bd), envir)
 
43
    as.function(c(value,
 
44
                  if(is.null(bd) || is.list(bd)) list(bd) else bd),
 
45
                envir)
40
46
}