You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Droping duplicates would be interesting for many cases, especially after using a concat.
Describe Preferred Solution
Loop over the array, pop_front elements one by one and use contains to identifiy if the element already exists in the shortest array (input or ouput) then add the element in the ouput array.
## Pull Request type
- [ ] Bugfix
- [X] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Build-related changes
- [ ] Documentation content changes
- [ ] Other (please describe):
## What is the current behavior?
Issue number [#172
](#172)
## What is the new behavior?
- Added the `unique` methods for `SpanTraitExt` & `ArrayTraitExt`,
- Added the corresponding unit tests.
## Does this introduce a breaking change?
- [ ] Yes
- [X] No
## Other information
For this little snippet:
```rust
let shortest: Span<T> = if (self.len() <= 1) || (ret.len() <= self.len()) {
ret.span()
} else {
self
};
```
Without the `self.len() <= 1` member some of my tests were failing.
Tried multiple things but couldn't find any better even though I feel
like there's a more optimized solution... Curious to have your inputs! 🙏
---------
Co-authored-by: akhercha <[email protected]>
Co-authored-by: gaetbout <[email protected]>
Feature Request
Describe the Feature Request
Droping duplicates would be interesting for many cases, especially after using a concat.
Describe Preferred Solution
Loop over the array,
pop_front
elements one by one and usecontains
to identifiy if the element already exists in the shortest array (input or ouput) then add the element in the ouput array.Describe Alternatives
To discuss if needed.
Related Code
No related code.
Additional Context
Some references discussed in telegram:
If the feature request is approved, would you be willing to submit a PR?
The text was updated successfully, but these errors were encountered: