The R Project SVN R

Rev

Rev 75581 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

% File src/library/base/man/is.function.Rd
% Part of the R package, https://www.R-project.org
% Copyright 1995-2018 R Core Team
% Distributed under GPL 2 or later

\name{is.function}
\alias{is.function}
\alias{is.primitive}
\title{Is an Object of Type (Primitive) Function?}
\usage{
is.function(x)
is.primitive(x)
}
\description{Checks whether its argument is a (primitive) function.}
\arguments{
  \item{x}{an \R object.}
}
\details{
  \code{is.primitive(x)} tests if \code{x} is a \link{primitive} function,
  i.e, if \code{\link{typeof}(x)} is either \code{"builtin"} or
  \code{"special"}.
}
\value{
  \code{TRUE} if \code{x} is a (primitive) function, and \code{FALSE}
  otherwise.
}
\examples{
is.function(1) # FALSE
is.function (is.primitive) # TRUE: it is a function, but ..
is.primitive(is.primitive) # FALSE: it's not a primitive one, whereas
is.primitive(is.function)  # TRUE: that one *is*
}
\keyword{programming}