Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Create a NamedTuple from a tuple of symbols and a tuple of values #53

Open
femtotrader opened this issue Apr 24, 2018 · 3 comments
Open

Comments

@femtotrader
Copy link
Contributor

Hello,

A NamedTuple can be created using

julia> @NT(x,y)(1,2)
(x = 1, y = 2)

but I wonder if there is a way to create a NamedTuple using a tuple of symbols and a tuple of values.
Something like:

julia> @NT(:x, :y)(1,2)

Any idea?

@femtotrader
Copy link
Contributor Author

It seems to be possible using:

julia> using NamedTuples: make_tuple

julia> make_tuple([:x,:y])(1,2)
(x = 1, y = 2)

Is there a better method to do this?

Maybe we should improve doc?

@omus
Copy link
Member

omus commented Apr 24, 2018

In #52 you can do: NamedTuple{(:x, :y)}(1, 2). Does that seem better to you?

@femtotrader
Copy link
Contributor Author

This syntax is much nicer.
We can close this issue when #52 will be merged

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

No branches or pull requests

2 participants