In general I am a +1, but I'd rather have these utility functions under 
`Tuple`, as `Tuple.first/1` and `Tuple.second/1`. 


Em segunda-feira, 22 de maio de 2023 às 07:25:03 UTC+6, halos...@gmail.com 
escreveu:

> Personally, I think that the names are excessively short and confusing. 
> `first_elem` and `second_elem` would be more meaningful.
>
> -a
>
> On Sun, May 21, 2023 at 9:06 PM Vinícius Müller <vinig...@gmail.com> 
> wrote:
>
>> Currently it is necessary to do `|> &elem(&1, 1)` or `|> &elem(&1, 2)` 
>> when trying to get a specific element of a tuple in a pipeline or normally.
>>
>> F#[0], Haskell[1], Ocaml[2] and other functional languages have the `fst` 
>> and `snd` functions, which simply extract the first and second elements of 
>> a tuple, respectively.
>>
>> I think it would make some code samples simpler, since it reads much 
>> better, I guess it's the same idea as using `|> hd()` rather than doing `|> 
>> fn [h | _] -> h end`.
>>
>> Does this makes sense for Elixir? If so, I'm willing to implement it.
>>
>> [0]: 
>> https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/tuples#obtaining-individual-values
>> [1]: 
>> https://hackage.haskell.org/package/base-4.18.0.0/docs/Prelude.html#g:3
>> [2]: https://v2.ocaml.org/api/Stdlib.html
>>
>> -- 
>> 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/8c965a60-d8a5-4384-aeb4-182a86c085bbn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elixir-lang-core/8c965a60-d8a5-4384-aeb4-182a86c085bbn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Austin Ziegler • halos...@gmail.com • aus...@halostatue.ca
> http://www.halostatue.ca/http://twitter.com/halostatue
>

-- 
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/09a1566c-01d0-4f4a-8548-0e9b7d18c6fbn%40googlegroups.com.

Reply via email to