[erlang-questions] Syntax for accessing a single value of a map

Bryan Paxton starbelly@REDACTED
Sat Jan 26 22:20:45 CET 2019


 Hi Donald,

This part of the syntax has not been implemented yet. Currently you need
to use maps:get/2 or maps:get/3 (http://erlang.org/doc/man/maps.html#get-2)


Example:

Eshell V10.2.1  (abort with ^G)
1> M = #{foo => bar}.
#{foo => bar}
2> maps:get(foo, M).
bar
3> maps:get(bar, M, undefined).
undefined
4>


Cheers

--

Bryan


On 1/26/19 2:04 PM, Donald Steven wrote:
> The book "Learn You Some..." notes that the syntax M#{K} may not work
> and indeed it results in an error when I tried to use it.  What is the
> correct syntax?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list