[Haskell-cafe] Lazy lists simulated by unboxed mutable arrays
ketil at malde.org
Wed May 28 07:16:53 EDT 2008
Ketil Malde <ketil at malde.org> writes:
> You've lost me at least.
...but perhaps I can find my way back on my own?
Today, you can choose between Array, with lazy elements, or UArray,
with strict elements.
Lazy arrays have the elements defined in advance, strict ones have
them calculated in advance - with the tremendous advantage of being
able to eliminate the pointer for each element. Otherwise a pointer
is needed to point to a potentially unevaluated thunk.
Perhaps there is a middle ground here, if you add the restriction that
the elements are generated in order? This way, you only need one
pointer to an unevaluated thunk (which will yield all remaining
elements as needed), and an unboxed array can contain the calculated
This would be very nice for e.g. sequence alignment, where the
alignment matrix is self-referencing, but the pointers represent a
very real cost to an already expensive (resource-intesive) solution.
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe