[erlang-questions] Must and May convention
Michał Muskała
michal@REDACTED
Thu Sep 28 21:11:28 CEST 2017
On 28 Sep 2017, 21:04 +0200, Vans S <vans_163@REDACTED>, wrote:
>
> I really like the ideas behind this but working with the yrl seems to be an undocumented dark art, and very time consuming to
> learn. There is so many things I would like to be able to do and to have the code compile to the same/functionally similar abstract form.
>
> my_fun(atom, Map=#{bitfield_set=> _}) ->
> Value = maps:get(key, Map),
> Value2 = maps:get(key2, Map, undefined),
> Value3 = maps:get(key4, maps:get(key3, Map, #{}), undefined),
> List = io:format("the atom as a binary is ~p ~p", [atom, Value]),
> unicode:characters_to_binary(List).
>
> VS
>
> fun my_fun(atom, Map=#{bitfield_set}) ->
> Value = Map[key]
> Value2 = Map[key2, undefined]
> Value3 = Map[key3][key4]
> "the atom as a binary is #{atom} #{Value}"
> end
>
The initial map proposal included a syntax for key access:
Map#{Key}
But it was never actually implemented.
Michał.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170928/f9126cb6/attachment.htm>
More information about the erlang-questions
mailing list