<div dir="ltr">Hello!<div><br></div><div>At the moment only the guards bifs operating on maps are supported in match-specs. i.e. you can do this:</div><div><br></div><div><div>1> Tid = ets:new(test,[]).</div><div>16400</div>
<div>2> ets:insert(Tid,[{#{ a => b },2},{a,3},{#{ a => b, c => d},4}]).</div></div><div><div>true</div></div><div><div>4> ets:select(Tid,[{{'$1','$2'},[{'and',{is_map,'$1'},{'==',{map_size,'$1'},1}}],['$2']}]).</div>
<div>[2]</div></div><div><br></div><div>but not any work with the values within a map. </div><div><br></div><div>Lukas</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 18, 2014 at 4:57 PM, Daniel Goertzen <span dir="ltr"><<a href="mailto:daniel.goertzen@gmail.com" target="_blank">daniel.goertzen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Maps match specifications are not working for me (see below). I know they were absent in the early maps branch, but I could not find anything saying they are absent from R17. I suspect they are just absent, but thought I would ask in case I've done something stupid or stumbled on a bug<br>
<br></div>Thanks,<br>Dan.<br><div><br><br><span style="font-family:courier new,monospace">12> ets:fun2ms(fun({_,#{foo:=bar}}) -> true end).<br>** exception error: no function clause matching ms_transform:normalise({map,1,[{map_field_exact,1,{atom,1,foo},{atom,1,bar}}]}) (ms_transform.erl, line 1063)<br>
in function ms_transform:normalise_list/1 (ms_transform.erl, line 1091)<br> in call from ms_transform:normalise_list/1 (ms_transform.erl, line 1091)<br> in call from ms_transform:normalise/1 (ms_transform.erl, line 1081)<br>
in call from ms_transform:normalise_list/1 (ms_transform.erl, line 1091)<br> in call from ms_transform:normalise/1 (ms_transform.erl, line 1081)<br> in call from ms_transform:normalise/1 (ms_transform.erl, line 1079)<br>
in call from ms_transform:transform_from_shell/3 (ms_transform.erl, line 215)<br><br><br></span><br></div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>