%% -*- ispell-dictionary: "american" -*-

\chapter{Library of Predefined Functions}\label{annex:library}


\Antescofo includes a set of predefined functions. They are described
mostly in the section~\ref{sec:expression}. For the reader convenience,
we give here a list of these functions. 

\newcommand{\vValue}{\emph{value}\xspace}
\newcommand{\vListable}{\emph{listable}\xspace}

The sequence of name after the function defines the type of the
arguments accepted by a function. For example, ``\code{numeric}'' is
used when an argument must satisfy the predicate \code{@is_numeric},
that is, \code{@is_int} or \code{@is_float}.
%% 
In addition we use the terms \vValue when the function accepts any
kind of arguments.



\paragraph*{Listable Functions.}
\index{function!listable}
\index{listable}

When a function $f$ is marked as \vListable, the function is extended to
accepts \code{tab} arguments in addition to scalar arguments. 
%% 
Usually, the result of the application of $f$ on a tab is the tab
resulting on the point-wise application of $f$ to the scalar elements of
the tab. But for predicate, the result is the predicate that returns
true if the scalar version returns true on all the elements of the tabs.

For example, \code{@abs} is a listable function on numerics: so it can
be applied to a tab of numerics. The results is the tab of the absolute
value of the elements of the tab argument. The function \code{@approx}
is a listable predicate and \texttt{@approx(\emph{u}, \emph{v})} returns
true if \texttt{@approx(\emph{u}[\emph{i}], \emph{v}[\emph{i}])} returns
true for all elements \texttt{\emph{i}} of the tabs \texttt{\emph{u}} and
\texttt{\emph{v}}. 


\paragraph*{Side-Effect.} 
\index{function!pure}
\index{function!side-effect}

\newcommand{\vImpure}{\emph{impure}\xspace}

The majority of functions are ``pure function'', that is, they do not
modify their argument and build a new value for the result. In some
case, the function work by a side-effect. Such function are marked as
\vImpure. We also qualify as \vImpure functions that do not produce a
side-effect but that may returns different values when called with the
same arguments (for example, the functions that return a random
number). 



\bigskip

