\Header{function}{Function Definition}
\alias{return}{function}
\keyword{programming}{function}
\begin{Description}\relax
These functions provide the base mechanisms for defining
new functions in the \R{} language.\end{Description}
\begin{Usage}
\begin{verbatim}
function( arglist ) expr
return(value)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{arglist}] Empty or one or more name or name=expression terms.
\item[\code{value}] An expression, or a series of expressions separated
by commas.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
In \R{} (unlike S) the names in an argument list cannot be quoted
non-standard names.

If \code{value} is a series of expressions, the value returned is a
list of the evaluated expressions, with names set to the expressions
where these are the names of \R{} objects.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{args}} and \code{\Link{body}} for accessing the arguments
and body of a function.

\code{\Link{debug}} for debugging; \code{\Link{invisible}} for
\code{return(.)}ing \emph{invisibly}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
norm <- function(x) sqrt(x%*%x)
norm(1:4)

## An anonymous function:
(function(x,y){ z <- x^2 + y^2; x+y+z })(0:7, 1)
\end{ExampleCode}
\end{Examples}

