Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper functions ToTupleX to create Tuple #92

Closed
CorentinClabaut opened this issue Apr 12, 2022 · 2 comments · Fixed by #93
Closed

Add helper functions ToTupleX to create Tuple #92

CorentinClabaut opened this issue Apr 12, 2022 · 2 comments · Fixed by #93

Comments

@CorentinClabaut
Copy link
Contributor

It would be useful to have functions ToTupleX to simplify the creation of Tuples.

It would be especially useful to convert the return of a function with multiple values into a single Tuple.

@samber
Copy link
Owner

samber commented Apr 12, 2022

Something like:

tuple := lo.T2("foobar", 42)

tuple.A  // "foobar"
tuple.B  // 42
func example() (string, int) {
    return "foobar", 42
}

tuple := lo.T2(example())

tuple.A  // "foobar"
tuple.B  // 42

?

@CorentinClabaut
Copy link
Contributor Author

Exactly.

I can provide a PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants