# Add support to map in ets:select\_replace with match spec

**URL:** <https://erlangforums.com/t/add-support-to-map-in-ets-select-replace-with-match-spec/2636>\
**Category:** Proposals: Ideas\
**Tags:** erlang-otp\
**Created:** [May 25, 2023, 9:55pm UTC](https://erlangforums.com/t/add-support-to-map-in-ets-select-replace-with-match-spec/2636 "2023-05-25T21:55:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erlangys](https://erlangforums.com/letter_avatar_proxy/v4/letter/e/c6cbf5/32.png) [@erlangys](https://erlangforums.com/u/erlangys)\
**Post date:** [May 25, 2023, 9:55pm UTC](https://erlangforums.com/t/add-support-to-map-in-ets-select-replace-with-match-spec/2636/1 "2023-05-25T21:55:34Z")

</div>

ets:select\_replace/2 can use match spec to do in place replacement with List, which is efficient. But it doesn’t support replacing map.  
For example, the change to a list works:  
ets:fun2ms(fun({K, L}) when is\_list(L) → {K, [marker | L]} end).  
Output: [{{‘$1’,‘$2’},[{is\_list,‘$2’}],[{{‘$1’,[marker|‘$2’]}}]}]  
But for something similar with map:  
ets:fun2ms(fun({K, Map}) when is\_map(Map) → {K, Map#{marker =\> true}} end).  
Error: the language element map (in body) cannot be translated into match\_spec  
{error,transform\_error}  
Is Erlang/OTP team considering adding support to map as well?

---

<div class="post-metadata">

**Author:** ![christhekeele](https://erlangforums.com/user_avatar/erlangforums.com/christhekeele/32/593_2.png) [@christhekeele](https://erlangforums.com/u/christhekeele)\
**Post date:** [February 12, 2024, 8:07pm UTC](https://erlangforums.com/t/add-support-to-map-in-ets-select-replace-with-match-spec/2636/2 "2024-02-12T20:07:44Z")

</div>

Came here to ask the same question!

Seems like there aren’t many recent updates, but it looks like this is [an open issue](https://github.com/erlang/otp/issues/7309) with [some experimentation](https://github.com/erlang/otp/pull/7326). I’d subscribe to those GH issues if you want updates, I know I have!
