-
Notifications
You must be signed in to change notification settings - Fork 181
Add takeEnd to Data.Sequence #884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Right idea, yes, but is it the right name? I think some libraries list discussion might be in order. The module currently has |
Hmm... I think indeed the naming convention should ideally be consistent within this library, so that would mean we would add I guess it makes sense that the naming scheme of bytestring and text is asymmetric because their data has a clear left-to-right ordering. In contrast |
I don't want to deprecate |
Previously requested in #159. |
Uh oh!
There was an error while loading. Please reload this page.
The
Data.Sequence
module is missing the common functiontakeEnd :: Int -> [a] -> [a]
wheretakeEnd n xs = drop (length xs - n) xs
.I think it is important to include this function because manually calling the
length
anddrop
functions can be error prone (I just fixed a bug in my own code).This function is present in other sequence-like libraries, most notably:
I believe the only reason it is not in Prelude is that this operation is not efficient on lists.
It was almost accepted into
Data.Vector
, but the implementor didn't have time to finish the work.The text was updated successfully, but these errors were encountered: