Why does Haskell have Data.Sequence? Aren't (lazy) lists already the most general forward iterators possible (by virtue of being free monoids)?
Take the 2-minute tour
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
The details are mentioned on the first paragraph on hackage. As pointed by @AndrewC they offer many operations efficiently example concatenating two sequences, viewing the right end of a sequence or adding elements at the end of a sequence. |
|||
|
index
, which gets ani
-th element in O(log(min(i,n-i))) time. For lists, the complexity is O(i). – Petr Pudlák Jun 29 '13 at 13:52