Reputation: 2443
I would like to put label to tuple data. I have following tuple data.
{"Bob","34","jp"}
Then I want to put label and make map.
%{name: "Bob", age: "34", from: "jp"}
I don't mind whatever labels come from. list or map or whatever else.
Please give me advice. Thanks.
Upvotes: 0
Views: 350
Reputation: 2443
members =
[{"Bob","34","jp"}, {"Geo","25","en"}, {"Cha","31","us"}]
|> Enum.map(fn({n, a, f}) -> %{name: n, age: a, from: f} end)
It was easy.
Upvotes: 1