[erlang-questions] lists module functions for maps?

Vance Shipley vances@REDACTED
Tue Sep 24 07:32:55 CEST 2019


On Tue, Sep 24, 2019 at 10:48 AM Richard O'Keefe <raoknz@REDACTED> wrote:
> I would argue that the focus of these functions is the maps, not the lists they happen to be inside.

In my mind this is all about lists. Think small maps and big lists.
That the terms are maps is a detail I have to deal with in processing
my lists. I just want the lists module to be orthogonal. If we aren't
going to move all the lists:key* functions to a 'records' module
(please don't) let's simply add support for the new term type which
"replaces" records.

Your example is certainly all about maps but it doesn't help my use cases.

> Perhaps the whole thing is inside out.  Perhaps what's really needed
> is something that says
>  - here is a list of maps and a key
>  - give me a map of lists and a list
>  If {M,R} = maps:transpose(Ms, K)
>  then R is the filter of Ms by the condition "does not have key K"
>  and M is a map from V to the filter of Ms by the condition "has V as
> value for key K".
> Only do the linear scan once.


-- 
     -Vance



More information about the erlang-questions mailing list