Vavr: Add removeX methods on Tuple

Created on 10 Jan 2020  路  9Comments  路  Source: vavr-io/vavr

It would be interesting to have remove methods on tuple to drop a value and convert the tuple to the inferior type, ie :

Tuple2 tuple2 = Tuple.of("1", 2);
Tuple1 tuple1 = tuple2.drop1();

It would allow chaining of drop and concat.

Thank you for your amazing work.

feature 芦vavr-core禄

Most helpful comment

No big deal, no big deal, @lpraud wanted the feature in the first place, it's fair he can provide the solution if he's able to do it and has done it already ;-)

Cheers

All 9 comments

Thank you for the kind words :)

I like the idea!

Regarding the naming, the collections use drop(n) to remove the first n head elements. The Seq interface (which is similar to Tuple) has remove(Object) and removeAt(int). However, we used removeAt(int) in order to avoid ambiguities with remove(Object).

Because there is no risk of having these kind of ambiguities, I would use the shorter remove1() instead of removeAt1() in the case of Tuples.


Please note that the generator.scala needs to be changed. We do not touch src-gen/**/* directly. Run ./gradlew clean check to generate sources and test the code.

@danieldietrich I can submit a Pull request about this feature, if you allow me

I saw your tweet this morning and thought it was a good shot to contribute to this library I'm using daily.
I've got it covered here this morning: https://github.com/agrison/vavr/commit/4e888fcdc27b68abe1a48f0e54c9a6a2e1a03961

I guess starting a racing duel on Twitter wasn't a good idea, now we have a race condition...

I will review the @lpraud's PR now. It already has tests implemented.......

Thank you so much @agrison for getting your hands on this issue!

Thank you @lpraud for creating the PR.

- Daniel

Tests were also implemented in my commit ;)

I thought no one wanted to do it since the issue was open 7 days ago

Oh nooo, blame on me. Sorry!

I'm currently solving one of the last issues and then I will release Vavr 1.0 !! It will be a release that polishes 0.10.x and prepares post 1.0 efforts. There's much more to come after that!

Solved with #2555

No big deal, no big deal, @lpraud wanted the feature in the first place, it's fair he can provide the solution if he's able to do it and has done it already ;-)

Cheers

No big deal, no big deal, @lpraud wanted the feature in the first place, it's fair he can provide the solution if he's able to do it and has done it already ;-)

Cheers

Thanks, didn't wanted to pre-empt your work. I also wanted to try working with the code generator ^^.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paplorinc picture paplorinc  路  6Comments

santiagopoli picture santiagopoli  路  6Comments

liviamoroianu picture liviamoroianu  路  3Comments

Pyeroh picture Pyeroh  路  3Comments

ronanM picture ronanM  路  3Comments