%% LyX 1.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[twocolumn,english]{article}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{babel}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 \newenvironment{lyxcode}
   {\begin{list}{}{
     \setlength{\rightmargin}{\leftmargin}
     \raggedright
     \setlength{\itemsep}{0pt}
     \setlength{\parsep}{0pt}
     \normalfont\ttfamily}%
    \item[]}
   {\end{list}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{html}

\makeatother
\begin{document}
\bodytext{bgcolor=white text=black}


\title{Rascal\\
the Advanced Scientific CALculator\\
\vspace{.5cm}Userguide\vspace{.5cm}}


\author{Sebastian Ritterbusch}

\maketitle
\tableofcontents{}


\section{Introduction}

Rascal is based on an extremely modular approach; depending on the
user's needs, various powerful modules can be compiled into the system.
Thus Rascal can be a light-weight tool as well as a very powerful
computational system. This user documentation is created during compilation
and describes the included features. 


\section{Basic Usage }

Invoking the program leads to a prompt where you can enter expressions.
The expressions or definitions are being evaluated as soon you press
return. A semicolon at the end suppresses any output. As an example: 

\begin{lyxcode}
>5+2

7

>5+2;

>
\end{lyxcode}
Variables are also supported, where the names are case-sensitive alphabetic
letters and may be followed by numbers. An assignment is done using
the equal sign:

\begin{lyxcode}
>MyVariable2=7;~

>MyVariable2{*}MyVariable2

49

>
\end{lyxcode}
Undefined variables are always assumed to be integer zeros. 

The user can also define functions of one variable (\( n \)-ary functions
can be implemented using vectors or matrices as arguments). The names
follow the same rules as the names of variables:

\begin{lyxcode}
>MyNiceFunction17(x)=x{*}x+5{*}x;

>MyNiceFunction17(2)

14

>EvalAt12(F)=F(12);

>EvalAt12(sqr)

~144~
\end{lyxcode}
The semicolon at the end of the definition is mandatory and the calling-method
is {}``call by variable{}'', similar to parametric {}``\#define{}''s
in C++ with the difference that changes in the operand-variables are
not forwarded to the original variable. Of course functions can be
nested and invoked with any data-type. If the data-type does not support
a certain operation, an error occurs. The last example shows how functions
can be used as variables, here the function value of {}``square{}''
at 12 was computed.

Conditional expressions can be realized using the C-style {}``?:{}''-operator:

\begin{lyxcode}
>5==3?2.3:17

17

>abs(x)=x>0?x:-x;

>abs(-18)

18

>abs(12)

12~~~~

>
\end{lyxcode}
If the condition before the questionmark is true, the first expression
is returned, else the second. In contrast to C the result-types of
the two alternatives here can be different, also both alternatives
are computed before the decision takes place, thus recursions are
not possible.

You can exit Rascal by entering {}``quit{}'' followed by a return.

If Rascal was compiled using the {}``libreadline{}'', then you may
use the cursor-keys to flip back to commands and results from before,
as well as benefit of command completition using the {}``tab{}''-key.

Furthermore the different modules predefine functions, which are documented
in the following sections.

\input{value.tex}


\section{Questions?}

Send questions, ideas, hints and congratulations to \emph{rascal@ritterbusch.de.}


\section{Licence}

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details. 

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\end{document}
