[elixir-core:8476] Re: [Proposal] Add invert() method to Map module

2019-02-08 Thread 'boris kotov' via elixir-lang-core
Just to throw some cents in her.. I think, it belongs into a library, like in other languages. The elixir core, is mostly used to build the elixir core itself and make it *extendable*. Just imagine this example Map.invert(%{foo: %{ what: :jo }}) %{%{jo: :what} => :foo}) ? Or %{%{what: :jo}

Re: [elixir-core:8474] [Proposal] Add invert() method to Map module

2019-02-08 Thread Xavier Noria
One discussion is about inclusion in core (settled), and a different discussion is about semantics. The point of invert is: when you as a programmer know the mapping is a bijection, and you need boths directions, you know invert is well-defined and can use it (present in some languages). If the

Re: [elixir-core:8473] [Proposal] Add invert() method to Map module

2019-02-08 Thread Dmitry Belyaev
First of all, I really think that 'invert' is very unfortunate name for such an operation. I was very surprised with the proposed semantic, which for me looks more like 'transpose' (remember matrix transpose). But even with that name the operation is possible to lose data if values are not