\label{functions}

Functions are a form of expression that may taks input arguments surrounded by parentheses. Most of the traditional BASIC \emph{statements} that does not return a value are \emph{functions} in \tbas , and like those, while \tbas{} functions can be called without parentheses, it is highly \emph{discouraged} because of the ambiguities in syntax. \textbf{Always use parentheses on function call!}

\section{Mathematical}

    \subsection{ABS}
        \codeline{Y \textbf{= ABS(}X\textbf{)}}\par
        Returns absolute value of \code{X}.
    \subsection{ACO}
        \codeline{Y \textbf{= ACO(}X\textbf{)}}\par
        Returns inverse cosine of \code{X}.
    \subsection{ASN}
        \codeline{Y \textbf{= ASN(}X\textbf{)}}\par
        Returns inverse sine of \code{X}.
    \subsection{ATN}
        \codeline{Y \textbf{= ATN(}X\textbf{)}}\par
        Returns inverse tangent of \code{X}.
    \subsection{CBR}
        \codeline{Y \textbf{= CBR(}X\textbf{)}}\par
        Returns cubic root of \code{X}.
    \subsection{CEIL}
        \codeline{Y \textbf{= CEIL(}X\textbf{)}}\par
        Returns integer value of \code{X}, truncated towards positive infinity.
    \subsection{COS}
        \codeline{Y \textbf{= COS(}X\textbf{)}}\par
        Returns cosine of \code{X}.
    \subsection{COSH}
        \codeline{Y \textbf{= COSH(}X\textbf{)}}\par
        Returns hyperbolic cosine of \code{X}.
    \subsection{EXP}
        \codeline{Y \textbf{= EXP(}X\textbf{)}}\par
        Returns exponential of \code{X}, i.e. $e^X$.
    \subsection{FIX}
        \codeline{Y \textbf{= FIX(}X\textbf{)}}\par
        Returns integer value of \code{X}, truncated towards zero.
    \subsection{FLOOR, INT}
        \codeline{Y \textbf{=} \{\textbf{FLOOR}|\textbf{INT}\}\textbf{(}X\textbf{)}}\par
        Returns integer value of \code{X}, truncated towards negative infinity.
    \subsection{LEN}
        \codeline{Y \textbf{= LEN(}X\textbf{)}}\par
        Returns length of \code{X}. \code{X} can be either a string or an array.
    \subsection{LOG}
        \codeline{Y \textbf{= LOG(}X\textbf{)}}\par
        Returns natural logarithm of \code{X}.
    \subsection{ROUND}
        \codeline{Y \textbf{= ROUND(}X\textbf{)}}\par
        Returns closest integer value of \code{X}, rounding towards positive infinity.
    \subsection{RND}
        \codeline{Y \textbf{= RND(}X\textbf{)}}\par
        Returns a random number within the range of $[0..1)$. If \code{X} is zero, previous random number will be returned; otherwise new random number will be returned.
    \subsection{SIN}
        \codeline{Y \textbf{= SIN(}X\textbf{)}}\par
        Returns sine of \code{X}.
    \subsection{SINH}
        \codeline{Y \textbf{= SINH(}X\textbf{)}}\par
        Returns hyperbolic sine of \code{X}.
    \subsection{SGN}
        \codeline{Y \textbf{= SGN(}X\textbf{)}}\par
        Returns sign of \code{X}: 1 for positive, -1 for negative, 0 otherwise.
    \subsection{SQR}
        \codeline{Y \textbf{= SQR(}X\textbf{)}}\par
        Returns square root of \code{X}.
    \subsection{TAN}
        \codeline{Y \textbf{= TAN(}X\textbf{)}}\par
        Returns tangent of \code{X}.
    \subsection{TANH}
        \codeline{Y \textbf{= TANH(}X\textbf{)}}\par
        Returns hyperbolic tangent of \code{X}.

\section{Input}

    \subsection{DIM}
        \codeline{Y \textbf{= DIM(}X\textbf{)}}\par
        Returns array with size of \code{X}, all filled with zero.
    \subsection{GETKEYSDOWN}
        \codeline{\textbf{GETKEYSDOWN} VARIABLE}\par
        Stores array that contains keycode of keys held down in \code{VARIABLE}.\par
        Actual keycode and the array length depends on the machine: in \thismachine , array length will be fixed to 8. For the list of available keycodes, see \ref{implementation}.
    \subsection{INPUT}
        \codeline{\textbf{INPUT} VARIABLE}\par
        Prints out \code{? } to the console and waits for user input. Input can be any length and terminated with return key. The input will be stored to given variable.

\section{Output}

    \subsection{EMIT}
        \codeline{\textbf{EMIT(}EXPR [\{\textbf{,}|\textbf{;}\} EXPR]...\textbf{)}}\par
        Prints out characters corresponding to given number on the code page being used.\par
        \code{EXPR} is numeric expression.
    \subsection{PRINT}
        \codeline{\textbf{PRINT(}EXPR [\{\textbf{,}|\textbf{;}\} EXPR]...\textbf{)}}\par
        Prints out given string expressions.\par
        \code{EXPR} is a string, numeric expression, or array.\par
        \code{PRINT} is one of the few function that differentiates two style of argument separator: \codebf{;} will simply concatenate two expressions (unlike traditional BASIC, numbers will not have surrounding spaces), \codebf{,} tabulates the expressions.

\section{Program Manipulation}

    \subsection{CLEAR}
    \subsection{DATA}
    \subsection{END}
    \subsection{FOR}
    \subsection{FOREACH}
    \subsection{GOSUB}
    \subsection{GOTO}
    \subsection{LABEL}
    \subsection{NEXT}
    \subsection{READ}
    \subsection{RESTORE}
    \subsection{RETURN}

\section{String Manipulation}

    \subsection{CHR}
    \subsection{LEFT}
    \subsection{MID}
    \subsection{RIGHT}
    \subsection{SPC}

\section{Graphics}

    \subsection{PLOT}

\section{Meta}

    \subsection{OPTIONBASE}
    \subsection{OPTIONDEBUG}
    \subsection{OPTIONTRACE}

\section{System}

    \subsection{PEEK}
    \subsection{POKE}

\section{Higher-order Function}

    \subsection{CURRY}
    \subsection{DO}
    \subsection{FILTER}
    \subsection{FOLD}
    \subsection{MAP}
