\Header{as.function}{Convert Object to Function}
\methalias{as.function.default}{as.function}
\keyword{programming}{as.function}
\begin{Description}\relax
\code{as.function} is a generic function which is used to convert
objects to functions.

\code{as.function.default} works on a list \code{x}, which should contain the
concatenation of a formal argument list and an expression or an
object of mode \code{"\Link{call}"} which will become the function body.
The function will be defined in a specified environment, by default
that of the caller.\end{Description}
\begin{Usage}
\begin{verbatim}
as.function(x, ...)

as.function.default(x, envir = parent.frame(), ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] object to convert, a list for the default method.
\item[\code{...}] additional arguments, depending on object
\item[\code{envir}] environment in which the function should be defined
\end{ldescription}
\end{Arguments}
\begin{Value}
The desired function.\end{Value}
\begin{Author}\relax
Peter Dalgaard\end{Author}
\begin{SeeAlso}\relax
\code{\Link{function}};
\code{\Link{alist}} which is handy for the construction of
argument lists, etc.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
as.function(alist(a=,b=2,a+b))
as.function(alist(a=,b=2,a+b))(3)
\end{ExampleCode}
\end{Examples}

