How to make a template for HashDict in elixir?

How can I map a template to a HashDict in Elixir? I can’t find any decent information anywhere. So, I have an example, and it is bound to a variable:

#HashDict<[{"a", 1}, {"b", 2}]>

And let's say I want to get 2

I tried something like this to test the concept, but no luck:

[{"a",1}, {"b",val} = a

But I get: (MatchError) matching right side value

Can someone help me?

+3
source share
1 answer

You cannot match a template by HashDict. In general, when you see something printed as #HashDict<...>, it happens precisely because its internal representation is "private". The cards go to Elixir 0.13 and they will maintain matching patterns (and other goodies).

+3
source

All Articles