Wow, awesome! Thank you, Andrey! 

On Friday, June 10, 2022 at 12:40:11 PM UTC-7 Andrey Yugai wrote:

> Hi Rudolf. Elixir actually has such wrapper already, and what's more cool 
> about it, it's implemented exactly how you suggested: 
>
>
> https://github.com/elixir-lang/elixir/blob/a64d42f5d3cb6c32752af9d3312897e8cd5bb7ec/lib/elixir/lib/kernel.ex#L1724
>
>
> Other tuple related functions are mentioned at the top of Tuple module 
> docs. 
>
>
>
> -------- Original Message --------
> On 10 Jun 2022, 22:25, Rudolf Manusadzhian < rud...@simplebet.ai> wrote:
>
>
> 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 elixir-lang-co...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/58227783-b0bf-4d0f-b1cb-df15f4df0f97n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/58227783-b0bf-4d0f-b1cb-df15f4df0f97n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/ff6ec447-f53f-445c-856a-808489b067a1n%40googlegroups.com.

Reply via email to