Spreadsheets appeal
to millions of users because they are
concrete,
declarative and non-iterative. However, the absence of
abstraction
facilities leads to models that are unwieldy, slow,
error-ridden
and difficult to maintain.

Hence users
should be able to define new functions within the familiar
spreadsheet
paradigm, without resorting to external languages such as
VBA in
Excel, and with speed comparable to built-in functions.

We present a
prototype spreadsheet implementation that achieves these
goals,
based on the concept of sheet-defined function. Type analysis
and
continuation-based compilation are used to generate efficient .NET
bytecode
from such sheet-defined functions at runtime. Thanks to the
platform's
just-in-time compiler the implementation is very fast.

We give several
examples of useful functions definable this way. We
show that
higher-order and recursive sheet-defined functions have
natural
uses. For instance, the Goal Seek numerical equation solver,
and
several other built-in functions from Excel, can be user-defined
in our
framework.

In future work,
we expect to support functions with a carefully
limited
form of state, and possibly to exploit the near-explicit
parallelism
of spreadsheet models.