Skip to content
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

sortNub could be lazier #426

Open
treeowl opened this issue Dec 12, 2022 · 0 comments
Open

sortNub could be lazier #426

treeowl opened this issue Dec 12, 2022 · 0 comments

Comments

@treeowl
Copy link

treeowl commented Dec 12, 2022

Most other nubbing functions are as lazy as possible, but sortNub takes O(n log n) time to produce the first element when it can be done in O(n). I'd expect there to be a version that's lazier.

lazySortNub xs = [x | x : _ <- group (sort xs)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant