Hi there. Recently I faced the situation where I wanted to "replace" the 
element of a tuple that was created dynamically from a list with the length 
defined at runtime.

While I found *:erlang.setelement(index, tuple, value) 
<https://www.erlang.org/docs/19/man/erlang.html#setelement-3> *does what I 
need, its arguments order and 1-based indexes are not that natural to 
elixir.

So I would propose to add a wrapper around *:erlang.setelement/3* to Tuple 
module. (I called it *replace_at* just because I was looking for the 
analogy of *List.replace_at* but for tuple*)*

I put together quickly a commit of how it could be implemented 
https://github.com/elixir-lang/elixir/commit/6e498edaf257e3fccf15bc5243c3ccf2d67e6e85

-- 
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/58227783-b0bf-4d0f-b1cb-df15f4df0f97n%40googlegroups.com.

Reply via email to