Proposal: add intersperse and intercalate to Data.Sequence

It seems there's enough interest to make it official. The usual two-week period begins now. Intersperse can be given very pleasant performance characteristics for sequences: the result can constructed incrementally as it is consumed. Intercalate cannot perform so pleasantly, but it seems odd to add one but not the other.

+1 from me.
Interestingly, it strikes me that the fingertree version of intercalate
could be made more efficient, even if the sequence version can't.
-Edward
On Sat, Dec 27, 2014 at 3:45 PM, David Feuer
It seems there's enough interest to make it official. The usual two-week period begins now.
Intersperse can be given very pleasant performance characteristics for sequences: the result can constructed incrementally as it is consumed. Intercalate cannot perform so pleasantly, but it seems odd to add one but not the other.
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

I guess you're talking about a situation where the annotations are somehow
compatible, so that you can try to reuse them somehow? I'm not sure if that
would work or not, but it's very far from true for sequences.
On Dec 27, 2014 3:54 PM, "Edward Kmett"
+1 from me.
Interestingly, it strikes me that the fingertree version of intercalate could be made more efficient, even if the sequence version can't.
-Edward
On Sat, Dec 27, 2014 at 3:45 PM, David Feuer
wrote: It seems there's enough interest to make it official. The usual two-week period begins now.
Intersperse can be given very pleasant performance characteristics for sequences: the result can constructed incrementally as it is consumed. Intercalate cannot perform so pleasantly, but it seems odd to add one but not the other.
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

I meant for a real finger tree w/ arbitrary measure, not a sequence. In the fingertree package the measure of a fingertree is the monoidal sum of the measures of its elements, rather than having measures be 1 for each leaf so you can easily compute the "total" of a flattened FingerTree v (FingerTree v a) to get you a known shape to play with, that is all I meant. Sent from my iPhone
On Dec 27, 2014, at 4:25 PM, David Feuer
wrote: I guess you're talking about a situation where the annotations are somehow compatible, so that you can try to reuse them somehow? I'm not sure if that would work or not, but it's very far from true for sequences.
On Dec 27, 2014 3:54 PM, "Edward Kmett"
wrote: +1 from me. Interestingly, it strikes me that the fingertree version of intercalate could be made more efficient, even if the sequence version can't.
-Edward
On Sat, Dec 27, 2014 at 3:45 PM, David Feuer
wrote: It seems there's enough interest to make it official. The usual two-week period begins now. Intersperse can be given very pleasant performance characteristics for sequences: the result can constructed incrementally as it is consumed. Intercalate cannot perform so pleasantly, but it seems odd to add one but not the other.
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On 2014-12-27 21:45, David Feuer wrote:
It seems there's enough interest to make it official. The usual two-week period begins now.
Intersperse can be given very pleasant performance characteristics for sequences: the result can constructed incrementally as it is consumed. Intercalate cannot perform so pleasantly, but it seems odd to add one but not the other.
+1
participants (3)
-
Bardur Arantsson
-
David Feuer
-
Edward Kmett