Overview
Flow Control
Agena offers various flow control
facilities such as
- if/then/elif/onsuccess/else
conditions,
- case of/onsuccess/else conditions similar to
C's switch/case statements,
- if operator to return alternative values,
- numerical for/from/to/by loops where
start, stop, and step values are
optional, and automatic round-off error correction of iteration
variables,
- numerical for/from/downto/by loops
where step values are
optional,
- combined numerical for/while
loops,
- for/in loops over strings and
complex data structures,
- while, do/as and do/until
loops
similar to Modula's while and repeat/until not() iterators,
- a skip statement to prematurely trigger the next
iteration
of a loop,
- a break statement to prematurely leave a loop,
- a redo statement to restart the current iteration of a
loop,
- a relaunch stament to restart a loop from its beginng all
over,
- try/catch to handle
exceptions.
Data types
available are:
- rational and complex numbers, with extensions such as infinity
and undefined,
- strings,
- Booleans such as true, false, and fail,
- the null value meaning 'nothing',
- multi-purpose tables implemented as associative arrays to hold
any kind of data,
taken from Lua,
- Cantor sets as collections of unique items,
- sequences, i.e. vectors, to internally store items in strict
sequential
order,
- pairs to hold two values or pass arguments in any order to
procedures,
- registers, i.e. fixed-size vectors that can also conceil data
through its pointer to
the top,
- user-defined types for sequences, tables, registers, and pairs to
allow for
special-purpose handling,
- data type validation with the :: and :- operators and the optional
double colon facility in parameter lists,
- threads, userdata, and lightuserdata inherited from Lua,
- multisets (bags), singly-, unrolled singly- and doubly-linked
lists, heaps, bi-directional maps, and dual numbers.
For performance, basic operations on most of these types have been
built into
the Agena kernel.
Procedures
with full lexical scoping are supported, as well, and provide the
following extensions:
- the << (args) ->
expression >> syntax to easily define simple
functions,
- remember tables to conduct recursion at high speed and at low
memory consumption, to
remember already computed results, and to use predefined results,
- user-defined types,
- the nargs system variable which holds the number of
arguments actually passed to a procedure,
- metamethods originally inherited from Lua to define operations
for tables, sets,
sequences, registers, pairs, and userdata,
- OOP-style methods for tables,
- self-defined binary operators.
Other Features
Some other functions are:
- graphical capabilities for the Solaris, Mac OS X, Linux, and
Windows versions,
- an arbitrary precision mathematical library,
- IPv4 network data transfer,
- easy configuration of your personal environment via the Agena
initialisation
file,
- an easy-to-use package system also providing a means to load a
library and define
short names for all package procedures at a stroke (with
function),
- enumeration and multiple assignments,
- scope control via the scope/epocs
keywords,
- accessibility of the last iteration value of a loop control
variable in the
surrounding block,
- functions to support fast text processing (see in, replace,
lower, and upper operators, as well as the functions
in the strings and utils packages),
- the binio package to easily read and write files in binary
mode,
- facility to store any Agena data to a file and read it back later
into a new session
(save and read functions),
- stack programming,
- extended tests on data at function invocation and return,
- undergraduate Calculus, Linear Algebra, and Statistics packages,
- @ and $ for fast mapping and
selection,
- various bitwise operators,
- direct access to the file system and the local network,
- dBASE III/IV file support to exchange data with standard
applications,
- XML, CSV, INI, gzip, and tar file support,
- full international code page support.