The most important feature is the funktional addressing of cells, unlike the traditional approach like A0, C5, etc. which is probably inherited from VisiCalc.
The basic features, which make teapot different from other spread sheet programs, are:
@(x,y,z)
.
Called with integer values, it evaluates to the value of the cell at the
given coordinates. You can omit any of these values, which means the
coordinates of the current expression will be used. Due to the functional
approach, of course any integer value may be a literal or an expression
which evaluates to a value of the type integer. Obviously, indexed
accesses come for free.
Alternatively, @()
can be called with a pointer
to a cell as argument. Elements of this pointer data type
refer to the position of a cell and are defined by labels or
functions. Labels make expressions much more readable: Instead of
A0+A1
(traditional) or @(0,0)+@(0,1)
, you
can use @(Fix_costs)+@(Variable_costs)
or, if you label
columns and rows, @(x(Costs),y(Paper))+@(x(Costs),y(Tapes))
.
(x()
and y()
evaluate to the column and row
of a pointer value.)
Another important element is eval()
. This function evaluates
to the value of the expression pointed to by the argument, but evaluation
takes place in the context of the current expression. Instead of using
many cells with the same expression, one cell could be labelled and the
other cells only refer to its expression. If the expression has to be
modified, only one modification has to be made.
teapot has no builtin programming language, because most programs written
in such languages are hard to maintain. If you want a full programming
language, you know where to find it. However, this does not mean
that e.g. conditional evaluation is lacking. Conditional evaluation is
possible through eval()
with a pointer, where one coordinate
contains one or more relational expression of which each evaluates to
0 or 1.
The mentioned clocked (iterative) expressions consist of two parts,
called the reset and the clocked part. The very first time a cell is
evaluated, the reset part will be used, and subsequent evaluations will
use the clocked part. The reset expression 1
and the clocked
expression @()+1
results in a cell, which will count upwards
each time the sheet is clocked. It is quite easy to model the game of
life or iterative computation of square roots as a spread sheet this way.
teapot is written in ANSI C and it should compile on any mostly POSIX compliant system, with the following two restrictions: SYSV curses is used for the user interface, so there is quick screen updating and function key support. The free SYSV curses clone ncurses works fine for that. Further, you need the Sun XDR library, but its code is also free available. teapot is known to work on Solaris 1.1.2, Solaris 2.3, HP-UX 9, Linux, FreeBSD 2.x and Ultrix 4.3. Porting to other systems is usually only a matter of changing the Makefile.
teapot is available via ftp as GNU zipped tar file with sources and documentation.