[Haskell-cafe] Q about last&init
haskell at ibotty.net
Thu Jul 17 23:12:33 UTC 2014
>> Is last function is something like "black box" written in C++ which
>> perform O(1)?
> This is not really about Haskell vs. C++, but about how the data
> structures look like in memory.
as tillmann said, it's about the data structures.
Data.Sequence sounds like it fits your algorithm very well. but maybe
one of the array libraries (vector, array, repa, accelerate) suits you
better. there are also mutable variants that live in `ST` or `IO`, so
you could translate your algorithm without any difference.
More information about the Haskell-Cafe