Does anyone want intersperse for Data.Sequence?

Joseph Abrahamson me at jspha.com
Sat Dec 27 15:14:16 UTC 2014


I'm with Greg on this one. Due to Sequence being abstract I think it's even more crucial to have a rich API. I think little missing things like intersperse move me back to using lists frequently.

On Sat, Dec 27, 2014 at 10:04 AM, Greg Weber <greg at gregweber.info> wrote:

> Sequence is not used nearly enough. I think anything useful in the List API
> should also be in the Sequence API.
> On Sat, Dec 27, 2014 at 5:50 AM, David Feuer <david.feuer at gmail.com> wrote:
>> Anyone else have an opinion? Bertram Felgenhauer pointed out to me
>> that a friendlier-looking expression is
>>
>> intersperse x xs = drop 1 $ fromList xs <**> fromList [const x, id]
>>
>> but this still may not be the most obvious thing. The main question, I
>> think, is whether anyone is likely to *use* an intersperse function
>> for sequences. If so, I think we should add it; if not, probably not.
>>
>> On Mon, Dec 22, 2014 at 7:11 AM, Felipe Lessa <felipe.lessa at gmail.com>
>> wrote:
>> > On 22-12-2014 09:03, David Feuer wrote:
>> >> containers master now uses a new mechanism to implement <*> that can
>> >> also be used directly to implement an efficient intersperse function
>> >> corresponding to the one in Data.List. The real question is whether
>> >> anyone wants one. The potential for clashing names is obviously a
>> >> point against. The other is that the same asymptotic bounds (but
>> >> almost certainly worse constant factors) can be obtained using
>> >>
>> >> intersperse x xs = drop 1 $ forwards $ Backwards (fromList [const x,
>> >> id]) <*> Backwards xs
>> >
>> > If the name clash is the only downside, I'm +1.  That intersperse
>> > definition isn't obvious :).
>> >
>> > Cheers,
>> >
>> > --
>> > Felipe.
>> >
>> >
>> > _______________________________________________
>> > Libraries mailing list
>> > Libraries at haskell.org
>> > http://www.haskell.org/mailman/listinfo/libraries
>> >
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141227/41e01c88/attachment-0001.html>


More information about the Libraries mailing list