ts/man/ts_function.Rd
2025-02-07 13:16:52 +13:00

32 lines
1.0 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/function.R
\name{ts_function}
\alias{ts_function}
\title{TS function definition}
\usage{
ts_function(f, ..., result = ts_void())
}
\arguments{
\item{f}{an R function}
\item{...}{argument definitions (only required if f does not specify these in its formals)}
\item{result}{return type (ignored if overloads are provided)}
}
\description{
TS function definition
}
\details{
Defining functions is the core of writing Rserve apps.
Functions are referred to as \emph{object capabilities} (ocaps),
as they are 'objects' that allow Javascript to access capabilities
of R with a restricted interface. Only arguments can be adjusted.
TS functions can be defined using existing (named) or anonymous functions.
Anonymous functions are useful in that the arguments to the functions
can explicitly be defined with their types as formal arguments:
\if{html}{\out{<div class="sourceCode">}}\preformatted{ts_function(function(x = ts_integer(), y = ts_string()) \{ ... \})
}\if{html}{\out{</div>}}
}