RE: The feature to find the value inside the nested map.

"Krukoff, John" <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <MWHPR2201MB11681EC43CF054E2BCB14AC2F60F9@MWHPR2201MB1168.namprd22.prod.outlook.com>
FWIW,

I also gave this a try a while a back, and tried to create a version that was easier to use at the expense of more complexity on the lens construction.

https://github.com/jkrukoff/optic

I found the complexity of lens composition to be a bit painful without a strict type checker, so took a slightly different approach for an Erlang library. The above library includes ready made modules for all the stdlib data types.

Thanks,
John K.

From: erlang-questions <[email protected]> On Behalf Of Ivan Uemlianin
Sent: Wednesday, June 16, 2021 1:11 AM
To: [email protected]
Subject: Re: The feature to find the value inside the nested map.

Agree.  Haskellers call them lenses.

There was a discussion about them here a few years ago:

  http://erlang.org/pipermail/erlang-questions/2015-November/086879.html

And there have been a few implementation attempts:

  2020 https://github.com/slepher/lenses
  2015 https://www.cs.otago.ac.nz/staffpriv/ok/lens.erl
  2012 https://github.com/jlouis/erl-lenses

Best wishes

Ivan

On 16/06/2021 03:04, 瀬川昂弘 wrote:
Assuming,
Map = #{a => b,c => #{1 => 2,3 => 4,5 => #{x => y}}}.

Expected:
maps:new_find_fun(Key = 5, Map) = {ok,#{x => y}}.

It's useful there is the above feature, in my guess.

--
Takahiro Segawa.
E-mail:[email protected]<mailto:[email protected]>



--

============================================================

Ivan A. Uemlianin PhD

Llaisdy



Ymchwil a Datblygu Technoleg Lleferydd

Speech Technology Research and Development



                    [email protected]<mailto:[email protected]>

                        @llaisdy

                         llaisdy.wordpress.com

              github.com/llaisdy

                     www.linkedin.com/in/ivanuemlianin<http://www.linkedin.com/in/ivanuemlianin>



                        festina lente

============================================================
*************************************************************************
This e-mail may contain confidential or privileged information.
If you are not the intended recipient, please notify the sender immediately and then delete it.

TIAA
*************************************************************************
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.