[erlang-questions] function clauses with maps (18.3)

Luis Azedo luis.azedo@REDACTED
Wed Mar 30 22:01:49 CEST 2016


Hi,

this doesn't compile in 18.3. is it supposed to work with the maps spec ?
maybe in a later release ?

-spec my_match(atom(), atom(), map()) -> any().
my_match(Classification, CarType, #{my_key := #{ Classification := #{
<<"cars">> := #{ CarType := Map}}}}) ->
....
variable 'Classification' is unbound
variable 'CarType' is unbound


this works but we're not taking advantage of function clauses.

my_match(Classification, CarType, M ) ->
    #{my_key := #{ Classification := #{ <<"cars">> := #{ CarType := Map}}}}
= M,
    Map.
....

TIA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160330/3f94142a/attachment.htm>


More information about the erlang-questions mailing list