Several methods for Data.Sequence

This patch contains several methods for Data.Sequence I've always thought were long missing: - scans. This addition is almost trivial with the Traversable instance, but to match properly with the Data.List definitions (which change the length of the output string) requires only a single cons or snoc. - replicate. I don't know why this hasn't been in Data.Sequence already, because with some care, it uses O(log n) memory and amortized time by sharing nodes internally, and that's pretty cool. - zip. This is the one I really wanted to see in Data.Sequence, and I tried out a number of approaches, most of which simply never could work. This implementation truncates the sequences to the same size and then zips from both left and right at once, aligning digits together and handling remainders appropriately. Look at the source for details. More importantly, though, my GHC benchmarks indicate this is oodles faster than the standard workaround -- converting to lists and back. Louis Wasserman wasserman.louis@gmail.com

Louis Wasserman wrote:
This patch contains several methods for Data.Sequence I've always thought were long missing:
Excellent! Can you make an official "library proposal"? It's not hard. http://www.haskell.org/haskellwiki/Library_submissions Basically, see section 2: make a Trac ticket; choose a discussion deadline (perhaps, 2 weeks from now); and then post back on this mailing-list including a link to the ticket, a copy of the description, and stating the end-of-discussion date. -Isaac
participants (2)
-
Isaac Dupree
-
Louis Wasserman