I’m working on a library to deal with deeply nested structures(it’s not some version of lenses). something to deal with the problemas that are mentioned here Local accumulators for cleaner comprehensions - Official Proposals - Elixir Programming Language Forum
i’ve explored the problem a little bit in elixir and got to something that seems promising, but since there wasn’t nothing really paritcular to elixir in my solution i decided to do it as a erlang library.
But to make that solution something easy to use, I gonna need to implement something like the Access behaviour in erlang(Access — Elixir v1.17.3), basically it gonna have some qualitify of life functions(get_in/2
, get_and_update_in/3
, pop_in/2
, put_in/3
, update_in/3
) and some helper functions(like Access.elem/1
, Access.at/1
, Access.all/0
).
that said, the elixir Access, support negative indexes(so if pass Access.at(-1)
it gonna get the last position in a list).
I’m already flagging all helper functions to deal with the different indexing(elixir starts at 0, erlang at 1). For the erlang community would it be nice to have the negative indexes support?