8000 sortNub could be lazier · Issue #426 · kowainik/relude · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
sortNub could be lazier  #426
Open
Open
@treeowl

Description

@treeowl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0