The R Project SVN R

Rev

Rev 74897 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/base/man/is.function.Rd
68948 ripley 2
% Part of the R package, https://www.R-project.org
74897 maechler 3
% Copyright 1995-2018 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
2 r 6
\name{is.function}
56186 murdoch 7
\alias{is.function}
31819 maechler 8
\alias{is.primitive}
9
\title{Is an Object of Type (Primitive) Function?}
10
\usage{
11
is.function(x)
12
is.primitive(x)
13
}
14
\description{Checks whether its argument is a (primitive) function.}
7125 hornik 15
\arguments{
16
  \item{x}{an \R object.}
2 r 17
}
23358 ripley 18
\details{
74897 maechler 19
  \code{is.primitive(x)} tests if \code{x} is a \link{primitive} function,
20
  i.e, if \code{\link{typeof}(x)} is either \code{"builtin"} or
21
  \code{"special"}.
23358 ripley 22
}
29362 ripley 23
\value{
31819 maechler 24
  \code{TRUE} if \code{x} is a (primitive) function, and \code{FALSE}
25
  otherwise.
7125 hornik 26
}
31819 maechler 27
\examples{
28
is.function(1) # FALSE
75581 maechler 29
is.function (is.primitive) # TRUE: it is a function, but ..
30
is.primitive(is.primitive) # FALSE: it's not a primitive one, whereas
31819 maechler 31
is.primitive(is.function)  # TRUE: that one *is*
32
}
286 maechler 33
\keyword{programming}