The reason why get_lazy does not pass the map is because you already have the map, since you pass it as first argument.
On Mon, Mar 20, 2017 at 03:44 David Long <[email protected]> wrote: > I was working on some code that would simply test if one key was in a map > and return it's value, and otherwise return a different key's value. > > The map had a form like the following: > > %{ > oncall: "dlong", > overrideoncall: "jsmith", > ... > } > > > If there was someone overriding on call then their name would be in the ` > overrideoncall` key, otherwise the key would not be in the map. > > I think this could be a nice use for `Map.get_lazy`, if the function had > the original map passed in, allowing me to write the code as follows: > > Map.get_lazy(on_call_group, :overrideoncall, &(&1[:oncall])) > > > Before I wrote a pull request, I thought I'd see if this is a feature that > makes sense to others? > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/719dc4fc-ae23-4437-b059-d91356e9b43b%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/719dc4fc-ae23-4437-b059-d91356e9b43b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4J7dZWROSBnBU7Ayn%3DhQGphp_ciFZTRf83XscDTQQ2z3w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
