relude icon indicating copy to clipboard operation
relude copied to clipboard

sortNub could be lazier

Open treeowl opened this issue 2 years ago • 0 comments

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)]

treeowl avatar Dec 12 '22 17:12 treeowl