Overview
Flow Control
Agena provides a range of flow control features, 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/downto/by loops with optional start, stop, and step values and automatic round-off error correction for iteration variables,
- 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 next statement that immediately proceeds to the next loop iteration,
- a break statement to exit a loop early,
- a redo statement to restart the current iteration of the
loop,
- a relaunch statement to reset and restart a loop,
- 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 depicting 'nothing',
- multi-purpose tables implemented as associative arrays to store
any kind of data,
taken from Lua,
- Cantor sets as collections of unique items,
- sequences, i.e. vectors, to store items in strict
sequential
order,
- pairs to hold two values,
- registers: fixed-size vectors that can also encapsulate data, with access controlled via a pointer to their top,
- user-defined types for sequences, tables, registers, and pairs enabling 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 store previously computed results, conduct recursion at high speed while maintaining low memory consumption,
- user-defined types,
- the nargs system variable which holds the number of
arguments passed with a call,
- metamethods inherited from Lua to define operations
for tables, sets,
sequences, registers, pairs, and userdata, including OOP-style calls,
- 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 and IPv6 network data transfer,
- easy configuration of the personal environment through the Agena
initialisation
file,
- an easy-to-use package system that allows you to load libraries and define short names for all package procedures at once,
- enumeration and multiple assignments,
- scope control using the scope/epocs
keywords,
- access to the last iteration value of a loop control variable in the surrounding block,
- functions for fast text processing, including the in, replace,
lower, and upper operators, the strings and utils packages,
- the binio package to easily read and write files in binary
mode,
- the save and read functions to store any Agena data to a file and read it into a new session,
- stack programming,
- extended checks on data at function invocation and of the result of a call,
- 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, JSON, CSV, INI, gzip, and tar file support,
- full international code page support.