Skip to content

Document that uniq keeps the last duplicate #214

Description

@no-longer-on-githu-b

The documentation of uniq does not specify exactly which elements are kept.

-- assume a /= b, b == c
Vector.uniq [a, b, c] = [a, c]

This is important when Eq instances do not consider all parts of the data structure.

Do you think this should be documented (and tested), or should this be left unstable?

Activity

  1. andrewthad commented on Oct 10, 2018

    @andrewthad
    Contributor

    If it is unstable, this should at least be documented.

  2. glguy commented on Oct 10, 2018

    @glguy
    Member

    I'd prefer things like this be documented to be unstable so that people aren't expected to memorize which behavior functions like these have when they're reading code using them. Instead of supporting the use of a surprise Eq instance via functions like uniq, functions that were explicit about their behavior and were parameterized over a relation that didn't have the implicit baggage of Eq would be much more appropriate.

  3. added this to the 0.13 milestone on Jun 11, 2020
  4. added a commit that references this issue on Jan 31, 2021
    5d8008f
  5. added a commit that references this issue on Mar 5, 2021
    e003aad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions