Now, *there's* an interresting question ... Personally, as an implementor, I'd vote for the second version, i.e. I think that future Haskell compilers are more likely to do away with the thunks than do update in place analysis. Why? Because if we really want sequentialization of the accesses and reuse of storage, we can (soon) use array transformers (cps), linear typesystems or perhaps array monads to express this at the source level. On the other hand, the optimizations that are needed in order to eliminate the thunks in the second version, namely driving (related to partial evaluation and Wadlers deforrestration) and dependency analysis (or index analysis or alias analysis), are either very useful for other purposes or well known from the parallelizing Fortran compiler world. #ifdef NIT_PICKING Isn't the type signature you give incorrect? The parammeters m and n must have type a (where (a,a) is the index types of the arrays). #endif My SEK 0.02 ... Karl-Filip ------------------------------------------------------------ Make the frequent case fast, and the fast case frequent!
