Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@msoeken
Copy link
Member

@msoeken msoeken commented Sep 23, 2020

This implements Unique from the proposal in #313.

Note that this function implements Unique wrt. the semantics, e.g., found in C++.

It returns an array with the same order but no adjacent equal elements. If one wants to have truly unique arrays, one can combine this function with Sorted (mentioned in the docs).

If we want a different semantics, we might need to add a comparison function to check for order, or a more general comparison function that returns (-1 for <, 0 for =, and 1 for >).

@msoeken msoeken requested review from cgranade and guenp September 23, 2020 11:09
Copy link
Contributor

@cgranade cgranade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for adding this!

Copy link

@guenp guenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good and useful addition! Just would suggest different naming as I'm not sure most people are familiar with the C++ semantics. And, would it make sense to actually add a TrulyUnique function as well, that returns all unique elements in an array?

Copy link

@guenp guenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some discussion, it looks like this was already discussed in the API design meeting, so I approve this PR.

@cgranade cgranade added the automerge Pull request is ready to be automatically merged, pending checks and reviews. label Sep 23, 2020
@cgranade cgranade merged commit dbde645 into feature/arrays Sep 23, 2020
@cgranade cgranade deleted the msoeken/unique branch September 23, 2020 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

automerge Pull request is ready to be automatically merged, pending checks and reviews.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants