[Haskell-cafe] How to use arrays efficiently?

Ketil Malde ketil at malde.org
Fri May 16 09:27:29 EDT 2008

"Lauri Oksanen" <lassoken at gmail.com> writes:

> Thanks for help. I did some tests with UArray and it does the trick.
> The problem remaining is, how to implement UArray Int (Double, Double, Double)?

As (UArray Int Double, UArray Int Double, UArray Int Double).
Or as UArray Int Double, but with a specialized lookup function:

   mylookup array index = (array!3*index, array!3*index+1, array!3*index+2)

I guess it would be possible to have UArray Int (# Double, Double,
Double #) - packing all three Doubles unboxed into the array, but I've
no clue how to go about automating that.

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list