
Henning Thielemann wrote:
I thought operations like "foldl'" and "drop" must be very fast on arrays (especially UArray) with appropriate pointer tricks, I mean pointer incrementing instead of indexing for "foldl'" and a pointer into the array for "drop". Is it planned to add such functions? Ok, if "foldl f x . elems" and "listArray (i,sufficientlyBig) . drop n . elems" are fused to high speed code, then these functions do not need to materialize in the API. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
As far as I'm aware, our arrays don't support any kind of zero-copy slicing, which is what your 'drop' trick amounts to. Zero-copy slicing would seem like an obviously nice thing to have for IArrays, though, I agree. For various different kinds of slices including projections. ByteString supports zero-copy substring, but it's based on ForeignPtr not UArray. On the fusing point I believe that the stream fusers believe they can make things like foldl . elems fuse but I'm not sure. Jules