My humble opinion about arrays and general functions...

Arrays and general functions are isomorphic, certainly in theory.
In practice, however, they are different and the differences
are significant.

In general, although the set theoretic definition of a function
is a set of ordered pairs, it is convenient to think of a function
as a rule.  That is, given an input, the rule tells how to compute
the output.  It may be that for some special functions, we want
to encode the rule as a lookup on some table, but in fact this
technique is not generally applicable.  Why store a gazillion
values for + when we can implement the rule in hardware?

Typically arrays are boxes which contain values.  That is, they
are multi-dimensional tables in which values can be looked up.
In the imperative world, the lookup cost is typically a constant,
guaranteeing timing behavior for various algorithms.  

In the functional world, nobody has figured out how to get all the
practical benefits of imperative arrays, for a variety of reasons.
Until these benefits are achieved, functional languages will not
be practical for most, if not all, scientific programming applications.
(apologies to the sisal community in advance -- my own interest
is in lazy functional languages like Haskell, where arrays are
in greater disorder).

It entirely misses the point of why arrays are hard to say that
there are no differences between arrays and general functions.
In theory, arrays are a snap.  You can have them in a variety
of interesting forms, but they don't come with the performance
guarantees they have in the imperative world, and that is the
problem of arrays in a nutshell.

And finally, it makes sense to have separate syntax for arrays
and general functions, because different behavior is expected
for the two.

Ken Sailor
[EMAIL PROTECTED]

Reply via email to